How to secure your htaccess file?

For security reasons, the [.htaccess] file contents should not be visible to the public. To secure it, add the following lines to the [.htaccess] file:

# Prevent Apache from serving .ht* files:
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>

  • 138 Users Found This Useful
Was this answer helpful?

Related Articles

How to change PHP configuration (memory, upload limit, and others) using the .htaccess file?

  PHP configuration (directives) like PHP memory limit, maximum upload size, post max size, and...

Error uploading large files (memory, HTTP or timeout error)

Change the following values in the [.htaccesss] file to upload large files:...

How to enable Server Side Includes (SSI) using htaccess?

If you are using Server Side Includes SSI in your HTML files, and they are not working, you most...

How to redirect HTTP to HTTPS and domain1.com to domain2.com using cPanel or htaccess?

You can configure redirect rules to perform various redirects. Some can be set up using your...