Welcome to the HostMaji Community! Ask a question or share a project to get started.

Tips & Tricks

A quick .htaccess trick to protect your wp-config.php file

Author's Avatar

Asked by Sandeep Maurya

September 21, 2025

Here's a simple but effective tip: add this code to the top of your .htaccess file to block web access to your wp-config.php file, one of the most critical files in WordPress. `<files wp-config.php>order allow,deny
deny from all</files>`

1 Answer(s)

User Avatar

Community Support Verified

Sep 21, 2025 at 11:15 AM

This is an excellent and highly recommended security tip, Sandeep! Thanks for sharing with the community.

Your Answer

Please log in to post an answer.