A common concern when creating addon domains is, "What about the corresponding subdomain and the possibility of seeing my site as http://primarydomain.com/subfolder?" or "I don't want my site to be seen those ways and I don't want to risk having duplicate content online."
Linking to the Primary Domain
The subdomain name and the primarydomain/subfolder name will not be seen by the search engines, unless you link to it.
EXAMPLE: Let's say you own mynewworld.com and decide to make it an addon domain. If you publish any links, purposefully or inadvertently, that point to http://primarydomain.com/mynewworld.com/ , then the search engines will learn of this name and make it part of their search results.
EXAMPLE: Let's say you own mynewworld.com and decide to make it an addon domain. If you publish any links, purposefully or inadvertently, that point to http://mynewworld.primarydomain.com/ , then the search engines will learn of this name and make it part of their search results.
If you make sure no links point to those names, the search engines won't find them.
The Importance of Index Pages
It's easy to make sure you don't purposefully link to those names, but what could cause someone to inadvertently link to these names?
If your public_html has no index page available AND indexing has not been disabled, then you need to check what your primary domain's website looks like. If it has a directory listing, also known as an "Index of page", then you are inadvertently making each file and folder name into a publicly available link. As soon as Google looks at your primary domain, it has all of those links.
EXAMPLE: Let's say you own mynewworld.com and decide to make it an addon domain. If you don't have any web page on your primary domain, you may notice the primary domain's website looks like this:
Index of primarydomain.com
/cgi-bin/
/mynewworld.com/
Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at primarydomain.com Port 80
This is very bad because now http://primarydomain.com/mynewworld.com/ is provided to the search engines.
Directory Indexing
AdriaHost helps prevent this from happening on all Shared Hosting plans by publishing a default.html page on your primary domain.
The best solution is to disable Directory Indexing in your public_html.
Alternatively, you could publish a landing page named index.html, or you could write complicated URL rewrite rules to prevent browsing the undesirable names (advanced and not recommended).
A robots.txt file is not a recommended solution because search engines may ignore your robots.txt rules.
What if Google Already Got Those Links??
First, be sure to do everything mentioned above.
Second, you need to disable the primarydomain.com/subfolder and subdomain.primarydomain.com names on your server. There are a couple ways to accomplish this.
You only need to choose one of these options:
- Do you have another already registered domain name that you can use? Change your primary domain name; this is the simplest solution as it fixes all links in Google involving the bad names. (Do not add the old primary domain back to the server.) This makes the unwanted names go away. If you have any coding that uses the old primary domain, you must update it.
- Are you an expert coder? Create redirects or rewrite rules to convert the bad names to the addon domain name. This can be tricky, as you need to be sure the conversion works for all the links found by Google. You can search "site:primarydomain.com" in Google to see all the links they have (replaceprimarydomain.com with your actual domain).
- A robots.txt file will not help at this point.