views:

58

answers:

3

Is it possible to hide a folder from the www directory so that the php files will not be seen if you access it through a web browser? I'm doing this because I'm not yet good enough to secure those files and the mysql database that they are manipulating. Or even a trick that would make the web browser not to be able to access the localhost is fine. Please

+5  A: 

Just put the files outside of the document root and include them from there.

Ignacio Vazquez-Abrams
I don't think this would be the solution, I forgot to tell that I am accessing this files using a vb.net program through the web browser function
You seem to have mistakenly tagged this question "php" then.
Ignacio Vazquez-Abrams
+6  A: 

If you have a directory and you don't want Apache being able to serve any file that's in it, you can create a .htaccess file in that directory, containing :

Deny from all

This will make sure Apache refuses serving any file from that directory -- but they will still be accessible by PHP scripts running from another directory or from the command-line.


If you want Apache to be able to serve the files, but not list the content of the directory when a user accesses that directory without any filename in the URL, you can use this in your .htaccess file :

Options -Indexes

This will disable listing of files inside the directory that contains the .htaccess file -- but will not prevent Apache from serving the files themselves.

Pascal MARTIN
A: 

A very simple trick if you don't have Apache, hence no access to .htaccess (that sounds like I'm repeating myself), just create a file index.htm or index.html containing NOTHING. Any attempt to access that folder will just show a blank page.

stillstanding
yeah thanks, Im not really using my brain at all at times, thanks a lot