The NeoSmart Files

Getting WordPress Super Cache to Run on a Windows (IIS or Apache) Server

If you’re a regular reader, you probably know by now that we just love performance and can’t get enough of server performance-improving software/code… Especially when it comes to WordPress.

Donncha has recently released a great plugin for WordPress, called "WordPress Super Cache." It builds on the original WP-Cache plugin by Ricardo Granada – except that it fixes all the bugs in the original implementation and has been written in enough pure PHP that it’ll also run on Windows servers – both IIS and Apache for that matter! <cue applause>

At the moment (as of version 0.3.1) it needs a bit of work to make it run, but not much. So here goes – 10 easy steps to get cached content on your IIS or Apache server under Windows:

  1. Download Donncha’s plugin here.
  2. Extract it so you have a /wp-content/plugins/wp-super-cache/ directory with all the files (like wp-cache.php) in there.
  3. Copy
    /wp-content/plugins/wp-super-cache/wp-cache-phase1.php to
    /wp-content/advanced-cache.php
  4. Open up /wp-content/plugins/wp-super-cache/wp-cache.php and locate this:
    [sourcecode language=”php”]function wp_cache_check_link() {
    global $wp_cache_link, $wp_cache_file;[/sourcecode]
  5. Replace that with [sourcecode language=”php”]function wp_cache_check_link() {
    global $wp_cache_link, $wp_cache_file;

    if ( file_exists($wp_cache_link) )
    return true;
    else {
    echo “advanced-cache.php does not exist
    “;
    echo “Create it by copying $wp_cache_file to $wp_cache_link on your server
    “;
    return false;
    } [/sourcecode]

  6. Log into your dashboard and enable WP Super Cache in the Plugins page.
  7. Go to the WP Super Cache options page and enable caching.
  8. Open /wp-content/wp-cache-config.php and look for "WPCACHEHOME" and correct
    a) Add an opening quotation mark before "C:\"
    b) Replace all "\" with "\\" or "/"
  9. Create your rewrite rules like it says in readme.txt. If your using Apache on Windows, use mod_rewrite. If you’re using IIS, you’ll need to use the 3rd party (non-free, but quite good) ISAPI_Rewrite 3.0
  10. If you have mod_gzip, mod_deflate, or IIS dynamic content caching enabled, make sure you don’t enable Super Cache gzip because it’s already being done on the server level (which is better, anyway! :))

Don’t forget to install either our XCache or eAccelerator plugins to speed up the stuff that WordPress Super Cache doesn’t cache, such as logged-in users’ visits and comment processing, etc. as well as visits by people who have commented (see below).

Known Issues

Update:

It seems that if you’re on an Apache server, it’s best to add a directive in httpd.conf stopping mod_gzip or mod_deflate from running in your WordPress directory, and instead using WordPress Super Cache’s built-in GZIP support. This is because Apache will not cache GZIP’d output, so you’ll end wasting thousands of precious CPU cycles re-GZIPping the same content over and over again. IIS users do not have to worry, IIS 6 GZIPs and caches all static content by default.