Forum Moderators: phranque
Say, domain b.com and c.com are parked on a.com, is it possible to 301 redirect so that:
a.com 301 redirects to aa.com
b.com 301 redirects to bb.com
c.com 301 redirects to cc.com
We've tried this in .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^a.com$
RewriteRule ^/?$ [aa.com...] [R=301,L]
RewriteCond %{HTTP_HOST} ^b.com$
RewriteRule ^/?$ [bb.com...] [R=301,L]
RewriteCond %{HTTP_HOST} ^c.com$
RewriteRule ^/?$ [cc.com...] [R=301,L]
But only the first one is working (a.com 301 redirects to aa.com), while b.com and c.com staying there with no redirect.
Any idea? Thanks in advance.
If you remove the (new) redirects, and you request b.com with your browser, does this display the same page as a request for a.com? If not, where in the server filepath is b.com's content located? This will be where you must place the redirect code for b.com to bb.com
Jim
If the content served for all domains is the same, then there is no reason that your domain redirects should not work. The main problem I see is that only the "home pages" will be redirected with your code, but you should still see a redirect.... Oh, wait. Be sure you are flushing your browser cache completely before testing any change to your code.
To make the rules pass the "page" URL-path, modify them to this format:
RewriteCond %{HTTP_HOST} ^(www\.)?b\.com
RewriteRule (.*) http://bb.com/$1 [R=301,L]
An alternate way to modify the code:
RewriteCond %{HTTP_HOST} ^(www\.)?c\.com(:[0-9]+)?$
RewriteRule .* http://cc.com%{REQUEST_URI} [R=301,L]