Protect your database credentials, salts, and security settings from hackers — with proven, server-safe methods.
The wp-config.php file contains your:
If exposed, an attacker gains full control of your site. Yet most hosts leave it readable by default. This guide shows you how to lock it down.
/public_html)600Upload wp-config.php to the parent directory (e.g., /home/youruser/). WordPress checks there automatically.
In cPanel File Manager or via SSH:
chmod 600 wp-config.php
This ensures only your user can read/write the file.
Add this to your .htaccess:
<Files wp-config.php>
order allow,deny
deny from all
</Files>
If you’re unsure about file permissions or server paths, our vetted Fiverr experts can:
Yes. WordPress automatically looks one directory above if it doesn’t find wp-config.php in the root. This is the most secure location.
600 (owner read/write only). Never use 644 or 755 — these allow other users on the server to read your database credentials.
No. WordPress reads the file via PHP, not HTTP. Blocking direct browser access prevents attackers from downloading it.
Only if they’re default or compromised. Use the official generator: WordPress Salt Generator.