Posted by Richard Levasseur on 09/30/83 11:51
deko wrote:
> >> 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.
>
Most likely not. The browser will look for the domain wwwXexample.com
instead of example.com. the same is true for www.exampleYcom. The
only thing that it could ever really match is a period because of how
it has to be formatted.
> 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]
>
>
Haha, did you read the conversatron by chance?
[Back to original message]
|