I have cPanel Hosting with only 1 IP. I'm in the process of pointing all my TLDs to this server.
I have created Addon Domains and all the folders from which it creates are located in sub directories example1.com
, example2.com
in my root website /home/user/public_html/client/
but they can also be accessed from example1.maindomain.com
. The thing that is worrying me is if Google indexes these subdomains.
What can I do to prevent this, would a rewrite rule like this be sufficient?
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example1\.com$ [NC]
RewriteRule ^(.*)$ http://www.example1.com/$1 [L,R=301]
</IfModule>
Or is there a better way?