WP Super Cache 0.8

WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

If you’re not interested in the changes, simply grab the latest version of the plugin and copy the files into your plugin folder. It’ll work, but if you’re upgrading, you should read on.

Major changes in this release:

  1. Generate a semaphore id based on hostname and cache path to avoid problems on shared hosts, props Tigertech.
  2. If you run WordPress from a different directory to where it’s installed, supercached files weren’t deleted when a post was made or updated. That is now fixed. Thanks Viper007Bond for all your help on that.
  3. Paged archives, category pages, and tag pages are now cleared when a post is edited or comment approved. This replicates what WP Cache did all along so you should hopefully see supercached static files updating more often.
  4. If your .htaccess is read-only, the mod_rewrite rules are displayed on the admin page. Thanks Matt for the patch.
  5. Updated mod_rewrite rules won’t serve static html files if there’s a “=” in the url. Should catch all sorts of problems with plugins and attachments. You’ll have to manually edit your root .htaccess to match the new rules.
  6. Set cache control and expiry headers of supercached files. They are cached for 5 minutes, but with a “must-revalidate” header. Delete wp-content/cache/.htaccess for the new rules to be updated.
  7. Check for WordPress MU because it can’t update the .htaccess file.
  8. Write supercache html to temporary files and rename. The old way opened the correct file for writing, did some work and wrote the file. In the fraction of a second it took to write the file, someone might request it and get an incomplete page.
  9. The Supercache expiry time has been removed. There can be only one.

Edit: 0.8.1 has just been released. This addresses the following:

  • The “forbidden files” problems some users had is fixed.
  • Supercache files were being removed needlessly when a moderated comment was made.
  • I added a “Clear cached files when post is edited” checkbox.
  • I added a “Delete Cache” link next to the Dashboard link on the dashboard.
  • Tigertech found that when a file is renamed and the new filename is already used, the old remains.
  • Updated readme.txt.

By Donncha

Donncha Ó Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Twitter.

55 replies on “WP Super Cache 0.8”

another lovely release. Simply love your plugin I believe that it should be built into wordpress. Its a lifesaver.

Thanks again.

Just thought of letting you know, my previous version of SuperCache (0.7.1) is not showing any new updates for it (maybe its not updated in the WP plugins repository).

What I would love in this plugin is an action that I can pass a URL (or regex pattern for a more advanced version) to and it will expire or delete the cache for that/them page(s).

Then I can call the “expire” action from a plugin that I know is going to modify the content on a particular page.

Joel – WordPress probably hasn’t checked the repository yet. It usually does it twice a day.

Barry – fancy submitting a patch? “Scratch that itch” you know!


just upgraded the plugin to version 0.8….now big problem, when i go to a cached page i have the message for example (it is the same with all the supercached page) :
You don’t have permission to access /wp-content/cache/supercache/ on this server.

I’ve been to see the permission of the file index.html for these pages and it is at 600 instead of at least 644 for people to have the ability to read the file.
I’m using WP-super cache since a long time and always update it with the process indicated in the wordpress plugin page. IT was working nice with previous version 0.7.1.
IS that a bug of this new version ? or is there something i missed during the upgrade process ?
thanks a lot.

Computer Aid – there was no need for it, and now that the plugin is more aggressive about clearing out of date cache files it doesn’t make sense any more. It also confused people why it was there in the first place!

Neokentin – that’s odd. Have you tried clearing the cache? There were no changes to permissions that would cause that to happen.

Who owns the file? Did your webhost change something today? Apache creates the files so it should be able to read it too.

ok i’ve try what you tell me, i clear the cache. it seems to work now but there is a strange thing that happen.
I use in order to check the loading speed of my blog. Before version 0.8 of wp super cache, everything was fine, it told me the speed to oad my blog. Now when i enter my address it told me :
URL doesn’t exist:

For the permissions, user get the permission to read and write, then groups have no permissions and other none too.

My webhost don’t change nothing today has it was working before upgrade of wp super cache, the problem appears when installing 0.8 … or maybe my webhost has changed something just at this moment but i don’t think so.

thanks for your help.

i forgot to told that for the autorizations it is only for the files inside the folder supercache.
For the others wp-cache-xxxxxxxx.html the permissions are :
user : read – write
groups : read
others : read

I’ve came back to version 0.7.1, now files that are in the folder supercache have these permissions :
user : read-write
groups : read
others : read

there is something with version 0.8 that remove the permissions of reading of groups and others…resulting in the forbidden message.
Also i redo the test with pingdom tools and now my url is accessible….

Hop this can help.

Something is horribly wrong with this version. The new supercache rules completely horked my site and I had to remove them to make it work again.

These are the rules it gave me. They absolutely do not work.

# BEGIN WPSuperCache

RewriteEngine On
RewriteBase /blog/
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/cache/supercache/%{HTTP_HOST}/blog/$1/index.html.gz -f
RewriteRule ^(.*) /blog/wp-content/cache/supercache/%{HTTP_HOST}/blog/$1/index.html.gz [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/cache/supercache/%{HTTP_HOST}/blog/$1/index.html -f
RewriteRule ^(.*) /blog/wp-content/cache/supercache/%{HTTP_HOST}/blog/$1/index.html [L]

# END WPSuperCache

Okay, I don’t know what went wrong where, bu 0.8 completely killed my site. Pages would no longer load unless I was logged in (some kind of weird extreme delay issue that I can’t work out.. pages simply never finished building and never returned anything), the new rewrite rules don’t work at all (resulting in page not found errors), etc.

Reverting to 0.7.1 and clearing the cache fixed it more or less instantly.

Otto – Thanks, can you email me your current (0.7.1) mod_rewrite rules? Please, what’s the value of get_option( ‘home’ ) and siteurl? Email is donncha @

@Donncha: I experienced the exact same issues as Neokentin. At the moment I have switched to Half On but it looks like 0.8 is mucking up the group and world read permissions. I had to clear my cache and drop back to half on to avoid forbidden page errors.

Great plugin. I am using this plugin from last 6 months.

I am facing problem loading the admin pages and sometimes even the wordpress blog. It gives 505 errors. Not sure whether it has to do with this plugin or my host.

Mellow, Otto – I think I know what’s happening. I’m guessing that Apache is running as a different user to php on your hosts. Somehow the “write to temporary file and rename it” process changes the username in a way that writing to the original file did not do. I’ll add a chmod to make the files world readable.

“Showbiz – are you sure? You should set the garbage collection value higher, perhaps to 5000 so it doesn’t check as often.”

hi donncha (sounds like pussycat dolls to me,lol..just kidding!)

i found the garbage collection in the code and deleted the 1000 and 2000 thingies and just saved the 5000. is that the correct way to do as per your reply? thanks

Showbiz – well, you could have just selected “5000” from the admin page without hacking any code, but that’s right.

Mellow – can you check who owns the supercache files? Is it the same user that owns the files in wp-content/cache/ (the wp-cache html files)?

OK, I have it nailed down, tagging release 0.8.1 in a few minutes with fixes for the permission denied bug and another bug where cache files are removed when a moderated comment is made.

hi, i tried this great plugin lots of time, but never used! it always cached 0 pages. Could you explain “You should have mod mime, mod rewrite and fancy permalinks enabled”? I use permalink structure. PHP Safe mod disabled.

Okay, so I tried out the new 0.8 rewrite rules with the 0.7.1 code, and it works without problems. So that part is fine, it must be the permissions thing that you’re talking about instead.

Hi Donncha, This is great.

But I still need your help over this one ISSUE:

– Over WPMU I have setup many blogs and sites. IF I enable WP Super Cache on one blog, the entire sites and blogs shall have WP Super Cache enabled. The same goes for disable.

– The only option now is to deactivate the plugin on the blogs which I don’t want to be cached.

– I wish Super Cache use some different mechanism to control this. Otherwise I will just have to stick with WP Cache, or none.

Thanks again, and wish things work out. Please email me if you do respond to my comment. I don’t subscribe because I know a lot of people will write.

Binh – the best thing you could do (and I think I said this on the forum too) is to hack wp-cache-config.php and exclude the or include the blogs you want cached or not.
There’s already code in there for identifying individual blogs so it should be easy to hardcode an array of blogs you don’t want cached and then set $cache_enabled to false.

Binh – the best thing you could do (and I think I said this on the forum too) is to hack wp-cache-config.php and exclude the or include the blogs you want cached or not.


Even easier, is an array in wp-config of matching http_hosts. If the current host matches, define the cache constant as true.

Makes it easier for upgrades, too.

Typically, on an average MU site, you’re only going to want to cache a handful of really active blogs, so this works out very well.

Hi Donncha!
Thanks for great plugin, it`s very helpful for me. But I slightly hack it.
I use Super Cache to PRE-fitch pages with cron to human. My cheap VDS is very, very slow – 300 Mhz, 128 Mb.
When I wont to collect RSS-feed (./news/) with SimplePie from 20-30 feed and re-arrange field at date it took about 30-40-60 second. Terrible lag!
I dont understood php for make something new, but I can to break something existing.
So, I change part of code on file advanced-cache, where
“$key = $blogcacheid . md5($_SERVER[‘HTTP_HOST’].preg_replace(‘/#.*$/’, ”, str_replace( ‘/index.php’, ‘/’, $_SERVER[‘REQUEST_URI’] ) ).$wp_cache_gzip_encoding.wp_cache_get_cookies_values());

“function key_managment(){
$key = $blogcacheid .md5($_SERVER[‘HTTP_HOST’].preg_replace(‘/#.*$/’, ”, str_replace( ‘/index.php’, ‘/’, $_SERVER[‘REQUEST_URI’])));

$key = $blogcacheid . md5($_SERVER[‘HTTP_HOST’].preg_replace(‘/#.*$/’, ”, str_replace( ‘/index.php’, ‘/’, $_SERVER[‘REQUEST_URI’] ) ).$wp_cache_gzip_encoding.wp_cache_get_cookies_values());

return $key;

$key = key_managment(); ”

also I add in
“$wp_start_time = microtime();
if( ($mtime = @filemtime($meta_pathname)) ) {
if ($mtime + $cache_max_time > time() || !preg_match(“/^curl/”,$_SERVER[‘HTTP_USER_AGENT’]) ) {
$meta = new CacheMeta;”
verify client for caching with cron only

and modify
“function wp_cache_get_cookies_values($var1) {
if($var1!=”/^wordpress_logged_in/”) $var1=”/^wp-postpass|^wordpress|^comment_author_/”;
$string = ”;
while ($key = key($_COOKIE)) {
if (preg_match($var1, $key)) {
$string .= $_COOKIE[$key] . “,”;”
to prevent caching logged user (it seems…)

Then I set cache time to 19 minute and cron time to 20 minute, and it work`s well!

So, is it possible to include something liking that to original plugin? I mean include option to cache some pages with time to live at one side and single named this pages for everyone, avoid mix name with cookies or something else, at another side.
I understand very well – its hole at security, but think sometime its useful.

PS. Sorry for my English – I`am from Russia and learning in school hmm…. so-so 🙂

I just checked in some experimental code that keeps copies of supercached files around after a comment is made so that anonymous users will see a slightly out of date cached file for a few seconds, but it should help a LOT on sites that receive lots of comments.

‘Course, I’m not sure if it’s worth it because the extra code does a lot of file checking and smaller sites won’t see any speedup. It might even slow down the site (slightly) for logged in users.

If you’re curious, give it a go by downloading the development version from or using Subversion to get it from

Hello! Thanks for a great plugin! I’m having an issue with the plugin caching some of my template files, even though I have included them in the ‘Do not cache’ section. For example, I have a template file, home.php, that is being displayed on my root/index page /. However, this page is still being cached. Is there some PHP I can put in my template file that will prevent it from being cached? Thanks.

Thanks for the great plugin Donncha!
I’ve using this nice plugin since 0.6.7 and running without problem.

But after upgraded to 0.8/0.8.1, my site is facing a problem that when an new post is made or an old post is edited, all cached and expired files for posts/tags/categories/paged under WP Cache and WP Super Cache were deleted (folders remain here but html files inside are deleted, the cache of pages remain here).

Is it the design of 0.8 that all posts/tags/categories/paged would delete when post change? Or just for that specific post, related tags and categories to be deleted when post change?

Since my site is quite busy site, so if every time make an new post or edit an old post would cause all cached and expired files clear, the server loading would increase rapidly.

So just want to check if it’s the problem on my own or it’s the original design of 0.8.


Brian – Did you enable the “clear all cache when post is edited” option? Unfortunately you can’t turn that off unless you edit wp-content/wp-cache-config.php
Also I discovered that the “edit_post” action is activated when a comment is left, thus clearing the cache as well which is definitely not what we want to happen!

The newest version follows more closely what wp-cache does – it deletes the cache file for the post plus deletes some other “non post” pages that seem to be related, although from testing they’re not always so.

Casey – you need to specify the urls, not the template files.

Donncha thanks for the reply.

I didn’t enable the “clear all cache when post is edited”. So there is no $wp_cache_clear_on_post_edit in my wp-content/wp-cache-config.php

With the concept you explained, may be I know what is happening to me… Most of my posts (95%) didn’t fill with content, instead numerous custom field values (metadata). As a result, those posts didn’t fill with content are considered as related, thus when a post is edited or made, nearly all of my cached and expired files are deleted. It is correct for my case?

is there any way to get statistics for the blog without using external services like google analytics or wordpress stats? e.g. Cystats is failing…

Greetings from Germany!

I have been using wp-super-cache for quite a while on several sites and really like it, but with version 0.8.4 on one of my sites ( it seems to be throwing up a 403 Forbidden that says

You don’t have permission to access /wp-content/cache/supercache/ on this server.
Apache/2.0.52 (Red Hat) Server at Port 80

I checked the file permissions and there is no index.html file. This is with the .htaccess rules added to the .htaccess file. If I take out and use the wordpress default .htaccess all works. If I’m logged in I don’t have any issue.

Strangely I don’t seem to have the same problem with the other sites I use it on (same version of super cache). Clearing the cache works for the first dynamic page load, but the second fails with the same forbidden error.

Leave a Reply