Example: denying access to some .htaccess files. Print

  • 0

Sometimes it becomes necessary to deny access to certain files. For example, to configuration files containing access details to databases, interfaces, etc. Let's say in the config.cfg file you store the login/password for accessing the database. Create a .htaccess file with directives in this directory:

<FilesMatch “\.(cfg)$”>

Order allow,deny

Deny from all

</FilesMatch>

Now, if a visitor types something like http://www.your_domain.ru/config.cfg in the browser, he will receive a 403 error or your page for this error.


Was this answer helpful?

« Back