How to deny access to Your wp-config.php File under WordPress Installation?

The wp-config.php file is one of the most important files in WordPress. It contains your user id, password, and database name in unencrypted format. It is important to protect this file. Otherwise, if others are able to access this file they can use your valuable credentials.

Follow the steps given below to deny access to your wp-config.php file:

1. First, log into cPanel.

2. Then go to your main directory.

3. Go to the .htaccess present in the www directory. Paste the code given below:

# to protect wp-config.php
<Files wp-config.php>
order allow,deny
deny from all
</Files>

After this, the code will deny access to the wp-config.php file for all.

Did you find this article useful?