Need help doing a 301 redirect for an addon domain

davioli

Regular Member
Joined
Oct 10, 2008
Messages
234
Reaction score
68
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.
 
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/)
 
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.
 
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.
 
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...
 
Back
Top