.htaccess - rewrite htaccess to include www and include rest of url -


the following code reditrects user www, if www missing in url, how redrirect same url including www

rewriteengine on rewritecond %{http_host} !^www\. rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,l] 

eg above redirects:

mydomain.com/gohere/

to

www.mydomain.com

but redirect to

www.mydomain.com/gohere/

thanks in advance responders. j

try code:

options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase /  rewritecond %{http_host} !^www\. [nc] rewriterule ^ http://www.%{http_host}%{request_uri}  [r=301,l] 

make sure test in different browser or clear browser cache.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -