On some website hosting companies the system is set up so that the main domain you signed up with acts as a master domain with a weird link to any other domains you host partially being subdomains or addon domains.
It is common with cPanel setups. Our old hosting provider Arvixe.com did this (we don’t recommend them for other reasons). Here’s an explanation of the behavior:
- You sign up with example.com as your original domain and host it on their servers.
- Later you also get otherdomain1.com and host it on the same account.
- Everything looks and works great, and your two websites appear to be independent.
- The problem is that if a person or bot visits otherdomain1.example.com they will be redirected to otherdomain1.com this means google and others could draw the link between the two sites and see that you own both. If that matters to you or not depends on what you’re trying to do.
- On some setups it will also be linked by the FTP file structure so that example.com/otherdomian1/ will also redirect to your otherdomian1.com website
The problem with some hosting set ups is that there is actually a link between them because your second domain (otherdomain1.com) is actually setup as a subdomain of your original domain in the server file structure.
To hide this link between your hosted domains is relatively simple but does require modifying your .htaccess file. If possible, do this through FTP access to your website files on the server.
In your preferred FTP program connect and navigate to the root directory of your original domain (example.com in this model). For a WordPress website this folder should contain a file called “.htaccess”
If the file isn’t there, start by checking your FTP settings to make sure hidden or system files are set to show. If you’re sure the file isn’t there you can create it with a simple text editor like NotePad.
If you have WordPress then the file probably exists and is populated with stuff. All you need to do is:
- download the .htaccess file from your original domain root directory
- save a copy of it – just in case
- then, before the line that says:
# BEGIN WordPress
- add this code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC]
RewriteCond %{REQUEST_URI} ^/otherdomian1/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/otherdomian2/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/otherdomian3/(.*)$
RewriteRule ^(.*)$ - [L,R=404]
</IfModule>
Make sure to replace example.com with your original domain, and replace ‘otherdomian1’, ‘otherdomian2’, and ‘otherdomian3’ with the subfolder names of your other domains as they appear in the FTP structure.
Upload this file back to your original domains root directory, overwriting the old version.
This should hide the link between your websites and just return the 404 page of the original domain instead.
If you are creating the file from scratch, start a new notepad file and name it “.htaccess” with no other extensions (ie. don’t include .txt at the end). In your new blank file add the same code and remember to replace the names as instructed above.
Then you would upload this file to your original domain root folder.
Alternative Method to block addon domain and main domain link.
This is inferior to the first solution, but it should work. If you prefer to block your new domains from being accessible as subdomains of your original domain by modifying the .htaccess file of the new domain only.
Before the line:
# BEGIN WordPress
Add the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} example.com$
RewriteRule ^(.*)$ "http://www.example.com/404" [R=301,L]
</IfModule>
Make sure to replace example.com with your original domain. Then you would upload this file to your NEW domain root folder (otherdomain1.com).
This essentially checks if someone has made it to your New domain from the subdomain link, and if so, they are bounced back to your original domains 404 page. So, anyone looking for otherdomain1.example.com will get sent to example.com/404
If you run into trouble: double check for any typos. If you need more help your hosting company should be able to easily help you make any modifications specific to their system.
Good luck!