Jump to content

Recommended Posts

hi everyone .. i have just finished developing a web application i hope to put on the www very soon. however my application has various folders that i dont want the public to access directly through a URL for example the images, config and includes folder which contain database and php scripts containing classes and functions and so on..

secondly in the includes folder for example i have a file called functions.php. so when someone accesses www.mysitename.com/includes/functions.php, i want a message to be output saying file cannot be accessed.

 

can anyone please tell me how i can go about this. thank you

Link to comment
https://forums.phpfreaks.com/topic/158399-php-security-problem-please-help/
Share on other sites

If you can modify or create an .htaccess file, you can put the following in it, and people will not be able to browse your directories:

 

Options -Indexes

 

And to keep people from accessing a file directly, you can you mod_rewrite with a rewrite rule such as:

 

RewriteRule ^functions.php - [F,L]

 

or use something like this:

 

<Files functions.php>

order deny,allow

deny from all

allow from yourwebsite.com

</Files>

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.