I have 2 domain example abcd.com as main domain and xyz.com as addon domain. I want to hide addon domain folder from main domain so visitor can't access abcd.com/xyz.com hosting on hawkhost. can you help me what can I do? thanks
Talk to your hosting provider about that issue and they will sort it out for you. I think this is best solution... On the other hand, I've had hosting like that and it was set up on the other way, it was not possible to access xyz.com from abcd.com/xyz.com just when you type in xyz.com... Talk with hosting and they will solve it for you!
There are three things to bear in mind to do what you want. The first is don't add your addon domain subdomain folder to the robots.txt because that is the fastest way search engines find it whether they index it or not (some wil ignore your robots.txt rules) The second is doing an .htaccess redirection in the root directory this way RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^abcd.com/addon-domain-directory$ [OR] RewriteCond %{HTTP_HOST} ^www.abcd.com/addon-domain-directory$ [OR] RewriteCond %{HTTP_HOST} ^xyz.abcd.com$ [OR] RewriteCond %{HTTP_HOST} ^www.xyz.abcd.com$ RewriteRule ^/?$ "http\:\/\/www\.xyz.\.com\/" [R=301,L] Code (markup): And finally upload another .htaccess to your addon domain directory with this rule RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^xyz.abcd.com$ [OR] RewriteCond %{HTTP_HOST} ^www.xyz.abcd.com$ RewriteRule ^/?$ "http\:\/\/www\.xyz.\.com\/" [R=301,L] Code (markup):
I think the best solution is to better design your document roots if possible. In cPanel when you add an add-on domain it suggests this: public_html/xyz.com This is just a suggestion for document root you could remove the public_html portion and just have xyz.com. In fact some of our customers get more creative they do things like this: sites/xyz.com sites/abc.com Or even do categories so something like this: sites/blogs/xyz.com sites/blogs/abc.com sites/forums/forumabc.com There is nothing stopping you from putting the document root of a site below the public_html folder. The public_html folder is the document root for the main domain. Anywhere you specify a document root for a domain makes it publically accessible for that domain.