How to install and configure WP Super Cache the Ultimate Guide
Google loves faster sites and considers it to be a vital factor for page ranking. Let’s face it, who doesn’t. A fast site is good – for me, for you, for your viewers and for the business. But getting a site to perform fast needs optimization. In this tutorial, we will show you how to improve performance of your WordPress powered site so it loads significantly fast using a free plugin called WP Super Cache.
Caching in WordPressWordPress serves dynamic pages. What that means is, the pages are constructed on the fly as an when they are viewed. This is done by combining PHP code with MySQL database queries. Database operations are always one of the most demanding and resource hungry operations any server can perform. Caching allows WordPress to serve ready made static pages. So instead of generating a fresh new content, an old cached version is served.
What are the Benefits
Ok, so you wrote a new article and tweeted a short link on Twitter, which has thousads and thousands of followers. Now each time your followers visit your article, it will be newly generated and served. That means for thousand followers, the page is being generated thousand times. If caching was enabled, then a cached copy of the page will be generated the first time when someone visits the article. All later users will be served a static copy of that article. This will free up server resources as it does not have to do any processing and can serve static content.
Caching is a must have feature, if you are using a shared host. As your server does not have to process any PHP files or MySQL database requests, your pages will load faster, even in heavy traffic.
What is WP Super Cache
It is an extremely popular free plugin for WordPress that performs full page caching . This plugin generates static html files from your dynamic WordPress blog which can dramatically speed up site performance.
Some great features that this plugin are
- Fast caching mechanism
- Enables CDN integration with WordPress
- Full site caching – serve a static site
- Page compression to reduce load time
- Mobile support
Please note that there is another popular WordPress plugin named W3 Total Cache which is also exceptional. We highly recommend that you use one of either two plugins. But don’t use them both at the same time.
You might be wondering what if someone made a comment? What would happen then? Static html files will be served to the vast majority of your users, but not all users. Static files are served to:
- Users who are not logged in.
- Users who have not left a comment on your blog.
- Or users who have not viewed a password protected post.
Administrators and regular users who make comments in your site are always served fresh content. In case a change was made to your post, the old cached version of the page will be deleted and a fresh new copy will be generated. So you can rest assured that your users will see the recent changes.
How to Install
Installing this plugin is really simple as it it available in the official WordPress plugin repository. Follow this steps
- Go to Dashboard > Plugins > Add New
2.Search for plugin “WP Super Cache”
3.In the search results page, locate WP Super Cache, and click “Install Now” button
4.Once the plugin is installed, click “Activate Plugin”
Enable WP Super Cache
When plugin is installed and activated, you will see a warning similar to this
Click on “plugin admin page” which will take you to “WP Super Cache settings page”. The very first time you land on that page, you will see a notification like the following figure.
It’s informing you that a necessary configuration setting was added to your WordPress configuration file. You should not see this message next time. If you do, then you should follow the Troubleshooting Guide.
WP Super Cache requires a custom url or permalink structure. If you are currently using plain permalinks, then you will see a notification like this
Go to Dashboard > Settings > Permalinks
On the permalinks settings page, select any structure other than plain. We are selecting “Post name”
Back to WP Super Cache settings page, you will see a group of tabs. Click on the easy tab. Caching is off by default. Turn in on and click “Update Status” button.
Enable CDN with WP Super Cache
Enabling CDN is as easy as they come with this plugin. Visit the CDN tab in the settings page.
First, tick the checkbox “Enable CDN Support” For “Off-site url”, enter your complete CDN URL, which will be the url of your pullzone. For example: http://cdn.layerpoint.comFor “Additional CNAMES”, provide a comma separated list of any other CNAME that you have created for your pullzone. For example, http://cdn1.layerpoint.com, http://cdn2.layerpoint.com etc. If you have not created any other CNAME, then you can keep this field blank.If you do not have a Custom or Shared SSL CDN URL, then you should tick the checkbox called “Skip https URLs to avoid “mixed content” errors”. It prevents SSL errors when you have some parts of your website under SSL.Finally, click “Save Changes”. You may want to delete the old cache to make sure fresh CDN powered content is served.
WP Super Cache is a powerful plugin, and comes with loads of configuration options. They can help you to further enhance your site’s performance. Let’s explore some powerful options.Cache hits to this website for quick access. (Recommended)”: this checkbox enables or disables caching. If you have already enabled caching in the easy setting tab, then this will be ticked. Make sure that this is checked to enable caching.Making sure that caching is enabled, below are three options which determines the way of caching.
This is the fastest caching method. It really is extremely quick. It relies on Apache web server and one of it’s module called mod_rewrite. If you have custom permalinks, then you probably already have mod_rewrite enabled. This mode needs a change in the Apache server configuration file i.e. .htaccess file. This method completely bypasses PHP. It’s best suited for times when you are getting a huge traffic and your server is slowing down. Please note that you can’t keep portion of your pages dynamic while using this mode.
To enable this mode, check “Use mod_rewrite to serve cache files.” option. Scroll down and click “Update Status”
You will receive a notification that “Rewrite rules must be updated”.
Scroll down to find a section called “Mod Rewrite Rules” and a yellow box with lots of configuration settings. Click on the button called “Update Mod_Rewrite Rules”
2.If everything works fine then the yellow box will turn green. Congratulations! You are now using the fastest caching available.
3.Use PHP to serve cache files. (Recommended): The default and recommended way of caching. It is almost as fast as Mod_Rewrite. This also needs custom permalinks to be enabled. You can keep parts of your page dynamic while using this mode. Do keep in mind that you may not receive optimal performance under heavy load while using this mode.
You should avoid using this mode. But if you still want to use it, then tick “Legacy page caching”, scroll down and click “Update Status”.
In the miscellaneous group, you should enable the following options
1.Compress pages so they’re served more quickly to visitors: A recommended option which uses Apache mod_deflate or PHP zlib compression to compress your web pages. Simple yet higly efficient, Compressed web pages mean a direct reduction in the file size that a browser has to download.
2. 304 Not Modified browser caching: This only works while using PHP mode. When enabled, a small header sent to your browser. This informs the browser whether an updated version of the current page is available or not.
3. Don’t cache pages for known users. (Recommended): When this option is enabled, caching will be disabled for users who log in to your website or post comments. You should keep this option enabled as administrators and regular users should see fresh content.
4. Cache rebuild: This option prevents a cached copy of the page from getting deleted while a new one is being generated. Only when a fresh cached copy is generated, the old one is deleted. This will help prevent excessive server load in times when you are receiving lots of comments in your posts.
In the advanced group, we recommend the following options
- Enable dynamic caching: If you are using PHP mode and want parts of your page to by dynamic, then enable this option
- Mobile device support: If you are using a separate mobile plugin to render a page formatted for mobile visitors, then you should enable this option. For a supported plugin, caching will be enabled.
Expiry Time & Garbage Collection
In the advanced tab, if you scroll down, you will see a section called “Expiry Time & Garbage Collection”. Nerd knowledge aside, what this simply means is the removal of outdated cache. Cached pages are fresh only for a limited period of time. “Cache Timeout” setting determines the time limit for a fresh cache copy. Outdated cached copies are not removed as soon as they become outdated. You need to tell the plugin when to remove outdated cache. This is what the schedular option is for. Use the Timer or Clock schedulers to define when the garbage collector should run and remove all outdated cache.
There is no best setting for this option. It all depends on what kind of content you are serving and how frequently your content gets updated. For a static site, you can set the timeout and schedular to something as long as 86400 seconds i.e. an entire day or even more. For a site with lots of new content, try setting the timeout to 60 seconds and the schedular to 90 or 120 seconds. If a site get updated once a day, at a specific time, then are you better off setting the timeout to 86400 seconds and use the schedular clock to set the Garbage collector to run after sometime when the site gets updated.
Clicking on the contents tab in plugin admin page will take to the page where you can view the list of currently cached pages.
This list is not automatically generated. You will have to click “Regenerate cache stats” if you want to see the list.
Just below is a link called “List all cached files”. This is really helpful. You can use it to list all files which are currently cached and delete any of them if you want to.
Serve static site
One of the most powerful settings of WP Super Cache is available in the preload tab. This option creates a super cache of all files and pages in your blog. Enabling this will allow you to serve a static site. This option is very useful if your site is not being updated anymore or maybe you want to serve a static site.
WP Super Cache is an amazing free plugin that showcases the powerful community of WordPress. If you have setup everything, then your site sholud load much faster now. We hope you found this tutorial useful. Do share your experience with us.