Forum Moderators: phranque

Message Too Old, No Replies

canonicalization+ redirection

domain to subdomain

         

specter

6:49 pm on Aug 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hello,

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]

g1smd

1:14 am on Aug 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Once the first rule has been matched and fulfilled, the second rule can never run, as processing stops right there.

If the first rule isn't matched then neither will the second, because it tests exactly the same thing "not www.domain.com".

jdMorgan

1:28 am on Aug 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I would make my main domain to point to a subdomain...
> Please,rescue me...

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

specter

1:52 pm on Aug 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>>>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...<<<

Do you think so?