redirected addon domains being indexed

zapatero

Registered
Dec 5, 2020
4
0
1
London
cPanel Access Level
Website Owner
I have several sites where old domains need to be redirected to new domains. So I have added them as addon domains and created redirects to the main domain, with wildcards, which work fine. However, I have noticed that Google is still seeing and indexing the old domains, with the content on the main domain, despite the redirects, so they are effectively duplicate websites. If I do a google site search for olddomain.com, all the pages from newdomain.com will appear on olddomain.com in the results with the current content (I know that by checking the cached version). Can anyone tell me why this is happening and any way to stop it? I've tried adding
Code:
Header set X-Robots-Tag "noindex, nofollow"
to the htaccess file in the addon domain's folder but I don't think it has any effect when there is a 301 in place, does it?
Thanks
 
Last edited:

zapatero

Registered
Dec 5, 2020
4
0
1
London
cPanel Access Level
Website Owner
To attempt to answer my own question, I think it may be to do with the fact that an addon domain is actually a subdomain made to appear as a separate domain. I don't fully understand the mechanics of it, but I suspect that Google is somehow accessing the main site content through olddomain.newdomain.com, which in effect makes olddomain.com an alias of newdomain.com. In which case, will redirecting that subdomain to the main domain fix the problem?
 

zapatero

Registered
Dec 5, 2020
4
0
1
London
cPanel Access Level
Website Owner
To attempt to answer my own question, I think it may be to do with the fact that an addon domain is actually a subdomain made to appear as a separate domain. I don't fully understand the mechanics of it, but I suspect that Google is somehow accessing the main site content through olddomain.newdomain.com, which in effect makes olddomain.com an alias of newdomain.com. In which case, will redirecting that subdomain to the main domain fix the problem?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,306
536
273
cPanel Access Level
Root Administrator
I'm glad you were able to resolve that. The addon domain would appear as a totally separate site to any web crawlers. In the future, you may want to try setting up an Alias (Aliases | cPanel & WHM Documentation) instead of an Addon as that allows you to have two sites pointed to the same document root while also using just one virtual host in the Apache configuration.