Saturday, 30 March 2013

Denying access to a particular folder on your web server

Suppose you have a directory in your web server which contains sensitive files like files containing database connection passwords , app-secret id's for using 3rd party services etc . You want to block access to that particular folder . So how are you going to do it ? Well it's pretty simple . Just add a .htaccess file to that folder . Open it up , and add the following lines :-

Order deny,allow
deny from all

This will deny access to any files in that folder . Remember that all those files in the folder can be accessed only if you add a require , include directive in a file on the server-side . However ajax calls or any sort of client request won't work on the files of that directory .


  1. I believe Web time sheet software makes the complete employee time clock tracking task easier. Its easy to update, approve and maintain the time sheets in no time.Time Attendance System

  2. Nice blog! Very interesting and informative post….Thank's for sharing such a nice information….Keep it up!!

    6 Month php Industrial Training in Chandigarh
    6 weeks php industrial training in chandigarh