Posted by deko on 12/04/84 11:51
>> How do I append to htaccess so that I can redirect requests for a
>> specific host to a particular directory?
>
> RewriteCond %{HTTP_HOST} ^www.example.com$
> RewriteCond %{REQUEST_URI} !^/example/
> RewriteRule (.*) /example/$1
>
> RewriteCond %{HTTP_HOST} ^example.com$
> RewriteCond %{REQUEST_URI} !^/example/
> RewriteRule (.*) /example/$1
Thanks - that helps.
A couple of follow-up questions:
Should I escape the periods in HTTP_HOST?
RewriteCond %{HTTP_HOST} ^www\.example\.com$
I assume that if I DO NOT escape them, then I would also match:
wwwXexample.com
or
www.exampleYcom
or both.
Also, what do you think about the value of rewriting urls without the "www"?
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule (.*) http://example.com/$1 [R=Permanent]
Thanks for the help!
Navigation:
[Reply to this message]
|