.htaccess - Remove www. in directory only -



.htaccess - Remove www. in directory only -

i'm trying remove www. single directory called dir (for example). need able .htaccess file in directory. (i don't have root access.) thought how create work?

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

update—the solution:

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

the http_host not contain path beingness accessed need match in rewrite rule itself:

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

.htaccess redirect url-rewriting no-www

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -