Jump to content

Make .htaccess restrict access to folder


CrazeD

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/114932-make-htaccess-restrict-access-to-folder/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.