Overview
Sooner or later you will discover the WP Super Cache plug-in for WordPress, but perhaps you’re running it on IIS 7 instead of Apache, and support for that is somewhat limited. Luckily, a two year old blog post on IIS Blogs still appears to work for the latest version of WordPress (3.0.1 at the time of this writing) and IIS 7.5, so that they will be presented here again in a somewhat condensed form.Prerequisites
The steps below make the following assumptions:- The web server has the Microsoft URL Rewrite Module 2.0 installed
- WordPress has Pretty Permalinks enabled.
Installing the Plug-in
The quickest way to install the plug-in is to use the plug-in manager in WordPress:- Log on to your WordPress blog as administrator
- In the navigation menu, click Plugins → Add New
- Search for the term WP Super Cache
- Click Install Now in the search result for WP Super Cache.
Configuring URL Rewriting
WP Super Cache uses URL rewriting to redirect external requests to your blog posts and pages to a separate directory that contains static HTML and GZIPed pages. These static files are automatically created and maintained by the plug-in, and they are the reason for the blog’s improved performance, because they do not require PHP and database execution. The WP Super Cache plug-in has been written for the Apache web server and will attempt to create and update .htaccess files within your WordPress installation, but those files have no effect when using IIS as the web server. To configure URL rewriting for IIS, perform the following steps:- Open the Web.config file in a text editor
- Add the following block right after the
section near the top of the file and before theentry for the WordPress Pretty Permalinks configuration:<rule name="WP Super Cache" stopProcessing="true"> <match url="^(\d{4})/(\d{2})/(.+?)/?$" ignoreCase="false" /> <conditions> <add input="{REQUEST_METHOD}" negate="true" pattern="POST" ignoreCase="false" /> <add input="{QUERY_STRING}" negate="true" pattern=".*=.*" ignoreCase="false" /> <add input="{QUERY_STRING}" negate="true" pattern=".*attachment_id=.*" ignoreCase="false" /> <add input="{HTTP_COOKIE}" negate="true" pattern="^.*(comment_author_|wordpress|wp-postpass_).*$" ignoreCase="false" /> <add input="{DOCUMENT_ROOT}\wp-content\cache\supercache\{HTTP_HOST}\{R:1}\{R:2}\{R:3}\index.html" matchType="IsFile" /> conditions> <action type="Rewrite" url="wp-content/cache/supercache/{HTTP_HOST}/{R:1}/{R:2}/{R:3}/index.html" /> rule> - Save and close the file.
Enabling Caching in WordPress
To enable serving cached WordPress files, make the following changes in the WordPress configuration file:- Open the file wp-config.php from the root directory of your blog in a text editor
- Add the following line before the first
require_once()function call at the bottom of the file:define('WP_CACHE', true); - Save and close the file.
Activating the Plug-in
Finally, the plug-in can be activated in the WordPress administration interface:- In the navigation menu click Settings → WP Super Cache
- Click on WP Super Cache
- On the Advanced tab…
- Check Cache hits to this website for quick access
- Select Use mod_rewrite to serve cache files.