How to Protect wp-config.php file in WordPress with .htaccess
And for those who don’t know, In wordpress wp-config.php is the file which holds all critical information about database, including username, password, host and database name.
So make yourself safe from hackers by protecting it by using the .htaccess file.
Simply add the following lines in the .htaccess file
<Files wp-config.php> order allow,deny deny from all </Files>