regex - URLs without www all redirect to home page -


what need redirect non-www urls corresponding pages www in url?

for example, there's page called www.mysite.com/contactus. if try access site via mysite.com/contactus, redirects www.mysite.com.

basically, i'd mysite.com/* go www.mysite.com/* instead of going home page. htaccess configuration? below have mod_rewrite. let me know if more information required.

<ifmodule mod_rewrite.c>     options +followsymlinks     rewriteengine on      rewritebase /      rewriterule .* - [e=http_authorization:%{http:authorization}]      rewritecond %{request_uri} !^/(media|skin|js)/      rewritecond %{request_filename} !-f     rewritecond %{request_filename} !-d     rewritecond %{request_filename} !-l      rewriterule .* index.php [l]  </ifmodule> 

insert rule below rewritebase:

rewritecond %{http_host} !^www\. [nc] rewriterule ^ http://www.%{http_host}%{request_uri} [ne,r=301,l] 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -