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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.