Forum Moderators: phranque
I would join main domain canonicalization with redirection.
I would make my main domain to point to a subdomain:
here my current .htaccess content:
# Redirect all non-canonical domain requests to requested resource in canonical domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.net
RewriteRule (.*) http://www.example.net/$1 [R=301,L]
I tried to add a second rule, like that:
# Redirect all non-canonical domain requests to requested resource in canonical domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.net
RewriteRule (.*) http://www.example.net/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.net
RewriteRule (.*) http://sub.example.net/$1 [R=301,L]
of course, it doesn't work...
Please,rescue me...
[edited by: jdMorgan at 1:30 am (utc) on Aug. 26, 2007]
[edit reason] example.net [/edit]
OK, I'll rescue you. It would probably be a big mistake to point your main domain to a subdomain, if you care about search engine ranking...
Also, you cannot just copy-and-paste mod_rewrite code and expect it to work. Please review your code against the mod_rewrite and regular expressions documentation, and try to fully understand it. If you have questions, feel free to ask.
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim