WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just a quick question that might help a tad bit with security. I noticed that the readme.html file has the version number listed. It reappears after each upgrade and so do the licence.txt, and wp-config-sample.php.

Is there a easy way to have WordPress auto remove these files after an upgrade?

I already block the version number from showing in the meta tags, rss feeds, atom, etc.

I know this type of security isn't exactly that much helpful, but just thought it might be a tiny start. I heard that people can simply check the version of jQuery that is included in WP-includes and cross reference which version of WP shipped it.

share|improve this question
up vote 12 down vote accepted

You don't really need to remove these files. It's much easier to just block access to them. If you are using pretty URL's you already have an .htaccess file. Using .htaccess to block the files is secure and you only have to add a directive once.

Blocking files is done by adding a directive to .htaccess like this:

    <files filename.file-extension>
         order allow,deny
         deny from all

So, to block readme.html you do this:

    <files readme.html>
         order allow,deny
         deny from all

Do the same with the license file or any other file you want to prevent anyone from accessing. Just open .htaccess in Notepad or any other basic text editor, add the directives and save, making sure that the text editor keeps the file name exactly - without any .txt on the end.

share|improve this answer
This is actually the option I ended up going with. It works perfectly. – Sahas Katta May 16 '11 at 4:49

Edit : you can also try these

share|improve this answer
Thanks, I figured out the php unlink feature and it works, but one issue. The hook you provided seems to execute by simply visiting the Updates section under Dashboard. Is there another hook for after the upgrade has occured? – Sahas Katta Dec 15 '10 at 20:16
ill take a look and let you know – Atif Mohammed Ameenuddin Dec 16 '10 at 10:23
@Sahas @atif089 Did you manage to get this to work? – INT May 12 '11 at 10:38

Here is my take:

RewriteRule (?:readme|license|changelog|-config|-sample)\.(?:php|md|txt|html?) - [R=404,NC,L]
  • 404 (not existing) rather than 403 (forbidden) to avoid any clue about existence.
  • also in subfolders (i.e. themes and plugins, which might offer attack opportunities)
  • case-insensitive, extension-flexible, also catches README.html, or license.html (feel free to add typical suspects like changelos|faq|contributing)

Personally, I would also block:

RewriteRule \.(?:psd|log|cmd|exe|bat|c?sh)$ - [NC,F]


  • '?:' just declares the bracket non-matching (no importance).
  • requires RewriteEngine to be on (most likely is. would be rare, to use wordpress without).
  • insert before the # BEGIN WordPress section in your .htaccess
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.