Quote:
|
Originally Posted by Feyd
Or if your conf file has the SERVER_NAME setup NOT as the FQDN, you could just do
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !www.athyrium.ca [NC]
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R]
|
I don't think that's right. If the HTTP_HOST for the incoming request is
www.athyrium.ca, the idea (I think) is to redirect the request to athyrium.ca -- so he'd want the lines to read instead:
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} =www.athyrium.ca [NC]
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R]
The exclamation point would say that the
http://athyrium.ca redirect occurs only if the incoming request is NOT
www.athyrium.ca. By using the equals sign we're saying the redirect is to occur only if the incoming request is
www.athyrium.ca.
Also, I think you want the [R] to read [R=301] so that a permanent redirect is signaled to the linking page (rather than the 302 temporary redirect that I believe is the default). Also, I think you want it to read [L,R=301] instead of just [R], so that the redirect occurs immediately. Then if there are any other redirect rules to be applied, they'll be applied to the redirected, correct athyrium.ca incoming request.