Which WordPress Core Files are Safe to Delete

Which WordPress Core Files are Safe to Delete

When installed, WordPress will add a number of files which can be safely deleted on any of your child sites.

The first of those files is readme.html, which is an information HTML file as part of the famous 5-minute install of WordPress manually.

The second of those files is wp-config-sample.php, which is an example of the wp-config.php file, which contains all the site’s database credentials and its salts, along with any constants being used.

Remember not to delete the wp-config.php file in the html folder of your site server. This will cause the site not to load, as the database will not be able to connect for your child site.

The readme.html file does not need to exist on your child site. You can safely delete it using a file manager plugin, or using an sFTP program to connect to your site server.

After you have installed the File Manager plugin, you can delete the readme.html and wp-config-sample.php files on the child site.

If you have had the readme.html file exist on the child site for a while, as a way to stop any users or bots hitting a file which does not exist anymore, you can easily set up a simple 301 redirect using a redirection plugin.

In this example, we are going to use the Redirection plugin.

Manage all your WordPress sites with the MainWP Dashboard

WordPress Management for Professionals

Are you ready to go Pro?

All MainWP Pro Extensions are available through one of our convenient bundled packages.

You can also use this CSV file to import into the Redirection plugin.

Tools > Redirection > Import/Export

In this example, using the very solid Safe Redirect Manager plugin:

If you are using NGNIX on the child site, you can use this in the site’s ngnix.config file for simple redirection:

server {
rewrite ^/readme.html$ / permanent;

If you are using Apache on the child site, you can include this in the sites .htaccess file for simple redirection:

RewriteRule ^readme\.html$ / [R=301,L]

If you use Linux, you can log in using the site SSH creds from Terminal or Putty, and you can run this command from the HTML folder:

cd html
rm -f readme.html wp-config-sample.php

With some simple clean up on your child site, you have removed two files you no longer need, and you’ve also created a redirect for any user or bot that tries to request the readme.html which can be viewed on the front-end of your site.

1 thought on “Which WordPress Core Files are Safe to Delete”

  1. Do not delete the sites wp-config.php file. But you can delete the readme.html and wp-config-sample.php files safely. Each WordPress core update they will be added back, minor or major versions.

Comments are closed.

Looking for something?

Your Download Is Just One Click Away

…or just download the plugin.

By entering your email, you agree to our Terms of Service and Privacy Policy.