Forum Moderators: phranque

Message Too Old, No Replies

need help: 301 redirect for parked domains

         

zacsg

7:16 am on Aug 1, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



Need some help for 301 redirect for parked domains.

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.

jdMorgan

4:17 pm on Aug 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"Parking" is not a precise technical term, so its meaning varies. As a result I must ask,:

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

zacsg

4:54 pm on Aug 1, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks, Jim.

By "parking" I mean the parking feature in cPanel. When there's no such redirects, visiting b.com (or c.com) will get exactly the same content on a.com.

jdMorgan

11:37 pm on Aug 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, not be pedantic, but that still does not help. There is no fixed definition for "parking" -- It's a dumbed-down term and could mean any one of several methods is being used behind the scenes.

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]

Other changes to allow the "www" subdomain as well, and to prevent problems if a port number is appended.

An alternate way to modify the code:


RewriteCond %{HTTP_HOST} ^(www\.)?c\.com(:[0-9]+)?$
RewriteRule .* http://cc.com%{REQUEST_URI} [R=301,L]

Jim

zacsg

6:46 pm on Aug 2, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks, Jim, we'll try it out.