Before installing WordPress on your server, you should know these simple wp-config.php tweaks to increase your WordPress site security. Even though these tweaks don’t necessarily protect your site 100% from being hacked, but still it’s a good practice to perform these tweaks in order to increase security layer to your site.
1. Change your default WordPress database table prefix.
In wp-config.php file, there’s a line where you can change your default WordPress database table prefix. By default, WordPress database table prefix is ‘wp_’. All WordPress sites that have the default prefix have the same database table name such as ‘wp_posts’, ‘wp_users’, etc.
By changing the default prefix, attacker will have to do extra work to mess with your WordPress database. To change the default prefix, change this line in wp-config.php file:
$table_prefix = 'wp_';
You can change ‘wp_’ with any value you want. You don’t have to remember the new prefix that you set because in order to retrieve the prefix, you can easily use
Tip: change the WP database table prefix with something short and unique.
2. Define authentication unique keys and salts.
This is fairly easy to do because all you have to do is go to https://api.wordpress.org/secret-key/1.1/salt/ and then copy all and replace the default value in wp-config.php file. They’re actually not required to make WordPress website live, but they’re quite important for extra security reason.
3. Set the WordPress debugging mode to false.
The WordPress debugging mode is actually set to false by default. But in case you change it before, you can disable the debugging mode by changing the ‘WP_DEBUG’ value like this:
WP_DEBUG is made for developers when developing something in WordPress. It will display errors when something happens on WordPress site. So if you enable WP_DEBUG on a live site, attacker could benefit from those error notices and try to hijack your WordPress site.
So these are some simple wp-config.php tweaks that you can do before installing WordPress. In case you have any extra tweak, please let us know in the comment below!