Reputation: 451
I am planning to create some addon domains through cPanel, I'm aware that their content can be accessed by visiting addondomain.maindomain.com
and maindomain.com/addondomain
- this could lead to duplicate content with search engines, amongst other things, so I would like to prevent this if possible.
After some research it seems the best (probably only) option would be to use .htaccess and rewrites so that the addon domain can only be accessed at www.addondomain.com - what is the best way to go about doing this and can I have the .htaccess file within the maindomain.com
directory or will I need it for each addon domain I create?
Any help would be much appreciated, thank you :)
Upvotes: 4
Views: 982
Reputation: 7888
RewriteRule ^addonedomain/(.*)$ http://addondomain.maindomain.com/$1
this code will redirect user from maindomain.com/addonedomain
directory to addonedomain.maindomain.com
!
it's better to put this code in .htaccess
file in root of add-on domain!
Upvotes: 1