CrazeD Posted July 15, 2008 Share Posted July 15, 2008 I hope this is the right section, I wasn't sure. So, my webhost uses standard cPanel. I can host multiple domains there, using addon domains. This creates a folder in my root for that domain. I want to disable access from my core domain from that folder. Example: url1.com goes to root. url2.com is an addon, and goes to root/url2 Currently, url1.com can access url2.com like so: url1.com/url2 Can I disable this somehow with .htaccess? I don't want a authentication, I just want it to maybe redirect or just give 404 error maybe. I asked my webhost if I could restrict access and they said all they could do was to put each domain in a folder in the real root (like before www or public_html folder) and then have the domain point there to each folder respectively. While this would work, it is a pain and I have to rely on them to set it up and make changes. So...can I do what I want with .htaccess? If so, how? Thanks. Quote Link to comment Share on other sites More sharing options...
apacheguy Posted July 16, 2008 Share Posted July 16, 2008 I'm not sure how to do it with htaccess, but I have a similar setup on my site where I redirect different domain names that all point to the same computer using mod_rewite. Quote Link to comment Share on other sites More sharing options...
CrazeD Posted July 16, 2008 Author Share Posted July 16, 2008 Any chance of a snippet or link to something to tell me what I need? Quote Link to comment Share on other sites More sharing options...
apacheguy Posted July 17, 2008 Share Posted July 17, 2008 RewriteCond %{HTTP_HOST} ^site1\.com$ [NC] RewriteRule ^(.*)$ http://site2.com$1 [L,R=301] This code tells mod_rewrite to redirect hits from site1.com to site2.com. Of course, this assumes mod_rewrite is enabled. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.