1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help doing a 301 redirect for an addon domain

Discussion in 'White Hat SEO' started by davioli, Nov 3, 2008.

  1. davioli

    davioli Regular Member

    Joined:
    Oct 10, 2008
    Messages:
    234
    Likes Received:
    67
    Hi... I need some help doing a 301 redirect for my addon domain..to prevent a duplicate content penalty.

    I got some code to put in htaccess by googling about the addon domain redirect.

    here is what I have done...

    Here?s the code of the main domain?s .htaccess file:

    Redirect 301 /addondomain http://www.addondomain.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^addondomain.maindomain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.addondomain.maindomain.com$
    RewriteCond %{HTTP_HOST} ^maindomain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.maindomain.com$
    RewriteRule ^sitelinkedin/?$ ?http://www.addondomain.com/? [R=301,L]

    And here?s the code for the Addon domain?s .htaccess file:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^addondomain.com$
    RewriteRule ^/?(.*)$ ?http://www.addondomain.com/$1″ [R=301,L]
    RewriteCond %{HTTP_HOST} ^addondomain.maindomain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.addondomain.maindomain.com$
    RewriteRule ^/?$ ?http://www.addondomain.com/? [R=301,L]

    When checking the validity of the 301 redirect...the "maindomain.com/addondomain" is showing a proper 301 redirect...
    all the others show a direct link..(no 301 redirect..)
    any idea what im doing wrong above?
    This would help alot of people... since many use multiple domains on single hosting accounts.
     
  2. davioli

    davioli Regular Member

    Joined:
    Oct 10, 2008
    Messages:
    234
    Likes Received:
    67
    forgot to mention the first code i put under the public_html of the main site.... while the second one i put in the addon domain folder (mainsite.com/public_html/addondomain/)
     
  3. wedge421

    wedge421 Registered Member

    Joined:
    Aug 18, 2008
    Messages:
    99
    Likes Received:
    15
    Would you just be able to do a simple double meta refresh? Instead of using the .htaccess you could just setup 2 php files that will blank the refer for you.
     
  4. davioli

    davioli Regular Member

    Joined:
    Oct 10, 2008
    Messages:
    234
    Likes Received:
    67
    For seo...you cant use that....the best way recommended by google is to have a permanent 301 redirect.
    This prevents addondomain.maindomain.com from getting indexed....so that only addondomain.com is indexed.
     
  5. wm8c

    wm8c Registered Member

    Joined:
    May 18, 2007
    Messages:
    65
    Likes Received:
    22
    Doesn't your host provide the information to do that? I may be misunderstanding your question, but with my host, you can easily do that through your control panel and the instructions are in their help files. I tried this on a couple of add on domains I have and ended up having more trouble than I bargained for with Google and ended up leaving as they were though...