In this article I will explain how to optimize your WordPress Super Cache to use mod_rewrite to serve your cache files fast and efficiently. The installation defaults are not ideal and will only help with the most resource-intensive sites. When optimized properly WP Super Cache can greatly increase visitor concurrency as well as reduce your bounce rate.
We have users running WordPress on shared hosting and getting anywhere from 3,000 to 10,000 unique visitors per day without issues while we have other customers that seem to struggle to handle more than a few concurrent users at once – both on the same type of plan! The difference between the two comes down to optimization.
One of the most important things you can do to increase the performance and reduce the resource usage of WordPress is to install and properly configure a caching plugin. The plugins we see most often are WP Super Cache ans W3 Total Cache. In this article I’m going to be discussing WP Super Cache.
WP Super Cache updated and the options on the advanced tab have changed slightly. You will now want to chose ‘Caching -> Expert’ in the Advanced tab rather than Caching -> Use mod_rewrite’. I will be updating this post shortly to reflect this change.
First and foremost you will want to install the plugin via your wp-admin -> Plugins. Once installed and you’re on the configuration page you’ll see something like this:
Many will, at this point, simply click “Caching On” followed by “Update Status” and assume that their site is now cached and optimized. While this will probably result in some improved performance the default configuration is not ideal from a performance or resource standpoint.
By default WP Super Cache will use PHP to serve the cache which means a process for each page load even if the content is already cached and then CPU/Disk I/O overhead in reading and serving that cache to the end-user. In short – it will help if your site is extremely slow without caching even without a lot of visitors – but otherwise it’s not much improvement.
What you want to do is switch to the “Advanced” tab and enable the caching and change the settings there. The settings you’ll want to make sure to set are:
- Cache hits to this website for quick access.
- Use mod_rewrite to serve cache files.
- Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.
Personally I like to enable these settings:
- Don’t cache pages for known users. If your site is really slow without caching I wouldn’t turn this on.
- List the newest cached pages on this page. I like to be able to see which pages have been cached most recently.
When you’re done it should look something like this:
Once you click “Update Status” you will more than likely need to allow WP Super Cache to add the necessary entries to your .htaccess file:
When you scroll down you’ll find a large yellow area – you’ll want to scroll to the bottom of it and click on the blue “Update Mod_Rewrite Rules” button:
The next page will show a lot of green headed with “Mod Rewrite Rules Updated!”
Next you’ll want to configure your cache expiry and garbage collection. I usually set my cache expiration to 86,400 seconds [1 day] but even setting it anywhere between 30 and 360 seconds would be helpful. The shorter the time – the more often the page will be re-cached even if it’s content hasn’t changed.
One thing to keep in mind is that generally when a post is updated or a comment is made – the cache for that page is dropped and a new one is generated anyways so having a long cache expiration generally is a good thing. There are some plugins that are not cache-friendly in which case you’d want to run shorter cache expirations.
Here is what mine usually looks like or very similar:
At this point your WP Super Cache plugin is optimized. On any page not previously visited and already cached your page load will take the same amount of time as it always has but subsequent page loads will be very fast until the cache expires.
It is still advised that you optimize your plugins and themes beyond simply caching your site – for example to speed up how long it takes a page to get cached on it’s first load or cache expiration. We’ll have another blog post detailing that process soon.
If you run into any problems with this or have any questions and you’re a customer feel free to open a support ticket or live chat and we’ll be happy to advise you. If you’re not a customer you can comment here on this post and we’ll address you here.
5 Replies to “Configuring WP Super Cache for Optimum Performance – Optimizing WordPress”
Nearly halved my monthly bandwidth usage just by installing Super Cache and using Jetpack Photon for images. Thanks for the tips!
Glad I could help. If you have any recommendations or suggestions that you feel would help others let me know and I’ll see about getting them added and/or writing a post about it.
Michael, your guidance has made a pronounced improvement in site performance using WP Super Cache. Thanks so much.
With WordPress now ruling as the leading website platform, such expert and trusted guidance is needed and appreciated.
should we not keep garbage collection hourly, as i reed this on another blog, however i am little confuse regarding the setting of wp super cache on shared hosting…
How often you garbage collect is ultimately up to you and depends on how busy your site is. The important part is making sure you’re serving the cache via mod_rewrite and not via PHP.