July 5, 2007
How to restrict access to files over web browser on a Linux server?
How to restrict files which are in Linux server, I want to restrict these files when the user tries to access this files using web browser. for eg my file is under the folder /var/www/html/xyz folder. files under these folder should not be accessed using http://mysite/xyz/abc.htm
- where as I want this file to be used using my php file so that if I want to show to users, then I will include this file using php.
- First, web server has its own "root" directory, "webroot". Second, if you do not want to show listing of some subdirectory of the webroot, clear 'x' bit for this directory using chmod command..
For more details, see both apache manual and also "man chmod" - if that file readable by your php script, that means that file also readable by anyone.
if that file is a php file, why dont you just add a conditional line to check wheter its called directly by client's browser or through your php script.
eg: if the referer not equal your php script then redirect to somewhere. - See The Manual of Apache
use .htaccess for that
To get more over .htaccess
Visit this URL
127.0.0.1/manualAlok Tiwari
- thanks in advance.























