Jump to content

Recommended Posts

Hi, I was wondering but how would I make it so that people when on my site can't access certain files like 'footer.php' which is used as an include in PHP like so:

 

include 'footer.php';

 

 

Basically I just want it so if the person tries to access domain.com/footer.php it'll return an error. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/276646-restrict-access-to-files/
Share on other sites

  • Solution

put the "included" files into a folder that doesn't permit any web access. there's two ways of doing that -

 

1) put the folder outside, rather than inside, your web root folder

 

or

 

2) put the folder inside your web root folder and put a .htacess file into the folder that deny's all http requests to the files in that folder. search for "htaccess deny all" to find out how.

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.