Articles Hierarchy
How to Secure Your Important Files
Protect your config file with easy but effective protection. This method can be used to protect all your important files.
The config file is the file that stores your databases username, password, and all that other important information that you site uses to connect to the db. Even though the config file is a php file it doesnt make sense to not do anything about it. Open a existing .htaccess file or create a new .htaccess, do not put anything in front of .htaccess.
Add the following code to the .htaccess file to protect the config file from being access by anyone.
<Files "config.php">
order allow,deny
deny from all
</Files>
Now we are going to protect the .htaccess itself by adding the following code to the .htaccess
<Files ".htaccess">
order allow,deny
deny from all
</Files>
Try accessing the config.php file and the .htaccess file, youll end up getting a 403 Forbidden page instead of a blank white page.
Tutorial written by Brandon
The config file is the file that stores your databases username, password, and all that other important information that you site uses to connect to the db. Even though the config file is a php file it doesnt make sense to not do anything about it. Open a existing .htaccess file or create a new .htaccess, do not put anything in front of .htaccess.
Add the following code to the .htaccess file to protect the config file from being access by anyone.
<Files "config.php">
order allow,deny
deny from all
</Files>
Now we are going to protect the .htaccess itself by adding the following code to the .htaccess
<Files ".htaccess">
order allow,deny
deny from all
</Files>
Try accessing the config.php file and the .htaccess file, youll end up getting a 403 Forbidden page instead of a blank white page.
Tutorial written by Brandon
Post Comment
Please Login to Post a Comment.
Ratings


Information
Resources
Submit





Nice tut! Worked a treat.