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

  1. 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.
  2. 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"
  3. 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.

  4. See The Manual of Apache
    use .htaccess for that
    To get more over .htaccess
    Visit this URL
    127.0.0.1/manual

    Alok Tiwari

  5. thanks in advance.

Tags: ,

Tell a Friend Today!

del.icio.us Digg Furl Reddit Ask BlinkList blogmarks Blogg-Buzz Google Ma.gnolia Netscape ppnow Rojo Shadows Simpy Socializer Spurl StumbleUpon Tailrank Technorati Windows Live Wists Yahoo! Help

Permalink • Print

Track this entry

RSS BlogPulse

RSS Technorati Cosmos

Related Searches

, , , ,