.htaccess - apache rewrite - remove www and keep path -
i have website operates in 2 urls:
http://sub.domain.com/ and
http://www.sub.domain.com/ i unify url , use version without www. google has links versions www linking specific article (the url of path). example:
http://www.sub.domain.com/folder/some.html i want redirect visitors remove www prefix address , keep path article. using example above rewrite url to:
http://sub.domain.com/folder/some.html let's clarify:
i want:
http://www.sub.domain.com -> http://sub.domain.com and
http://www.sub.domain.com/folder/some.html -> http://sub.domain.com/folder/some.html after apply rules:
rewriteengine on rewritecond %{http_host} ^www\.sub\.domain\.com$ [nc] rewriterule ^(.*)$ http://sub.domain.com/$1 [r=301,l] i get:
http://www.sub.domain.com -> http://sub.domain.com ^^ works fine :)
and
http://www.sub.domain.com/folder/some.html -> http://sub.domain.com ^^ works wrong :(
my other current htaccess rules: http://pastebin.com/c74u7mgl
add .htaccess in web root / directory
rewriteengine on rewritecond %{http_host} ^www\.sub\.domain\.com$ [nc] rewriterule ^(.*)$ http://sub.domain.com/$1 [r=301,l]
Comments
Post a Comment