TECHIES WORLD

For Techs.... Techniques.... Technologies....

ApacheCpanelLinux

How to deny access to a file using htaccess

Sometimes we need to block the web access to specific files. This can be achieved by configuring htaccess rules as following.

For Apache 2.2,

<Files "file">  
  Order Allow,Deny
  Deny from all
</Files>

For Apache 2.4+,

<Files "file">  
  Require all denied
</Files>

Here we need to replace file with the name of the file that we need to block the web access.

Leave a Reply