Jump to content

Recommended Posts

Hello all,

 

I have a directory on my server that I would like to protect so that people cannot open and see the files - easy enough  - But I also need to access these files from within my site using a require_once () or an include() but if the files and directory are protected How can I??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/157954-require_once-with-security-concern/
Share on other sites

By moving the directory outside of the website document root

 

i.e

# document root

public_html

# includes directory

public_html/includes

 

 

to

# document root

public_html

# includes directory

includes

 

You can still include files from the includes directory in your scripts using the correct path however there is no access publically i.e http://www.xyz.com/includes

 

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.