In this tutorial, you will learn the best practices and configuration settings for WP Super Cache, one of the best caching plug-ins for WordPress.
Importance of Caching a WordPress Blog
If you are not yet aware of the importance of caching, take time to read the points below:
1.) WordPress content is driven by PHP. This means all content you see in the browser are served dynamically and generated using PHP.
2.) It is dynamic in the sense that content are being fetched from the MySQL database and sent to the user browser using PHP.
3.) When the server runs a PHP script to fetch the content, it consumes a lot of resources in terms of CPU usage and memory on the server computers. This will be a limiting factor on your website performance especially if you have a high traffic blog.
4.) Caching solves this problem by generating a static HTML file of every WordPress blog post. These static HTML file does not anymore require executing PHP scripts to serve content to your readers.
5.) With caching enabled, things run smoothly and quick on the side of your users. It is because; there is no more complex database communications and script execution. This helps your WordPress blog loads faster in any browser.
6.) With PHP execution operations at a minimum because of caching, you save a lot of precious CPU and memory usage for your WordPress server.
7.) You website can accommodate or serve high level of traffic at lower resource usage.
See the analogy/illustration below:
Optimal Settings for WP Super Cache
One downside of using caching plug-ins in WordPress is that it’s too complicated to understand for any beginning webmaster. One reason of this problem is the lack of understanding of caching mechanism. Well, if you have read the previous information carefully you should have a pretty idea how caching would work.
Another reason is that plug-in developers often provides tons of features to their caching plug-ins and it’s almost impossible to digest or understand all of them even for a novice webmaster. This is true for WordPress Super cache and some caching plug-ins are even more complicated.
To make this very easy for you, recommended optimal settings would be provided. This applies for most blogs that don’t depend on CDN and have enabled mod rewrite modules in their Apache server. This assumes you have fully installed super cache but you have not yet configured it for optimum use. Don’t be confused about mod rewrite or PHP caching you will deal that in the settings below.
The following are some very useful configuration steps. These are the fastest and most efficient WP Super-cache settings:
1.) Login to your WordPress admin panel — Settings – WP Super Cache.
2.) Under “Easy” make sure “Caching on” has been checked. By default, PHP caching would be enabled but this is not optimal.
3.) Go to “Advanced”, do the following:
a.) Check “Cache hits to this website for quick access”.
b.) Check “Use mod_rewrite to serve cache files” – this requires your blog to have mod rewrite and mod mime modules installed in your server. If you do not know this, send an email to your web host support to confirm that this is enabled on your blog.
c.) Check “Don’t cache pages for known users”.
d.) Check “Cache Rebuild”.
e.) Check “Mobile Device Support”.
f.) Check “Extra homepage checks”.
4.) Click “Update Status” button.
5.) You should then see a message:
Rewrite rules must be updated
The rewrite rules required by this plugin have changed or are missing.
To clear this error, scroll down and click “Update Mod_Rewrite Rules”. You should then see “Mod Rewrite Rules Updated”. You have successfully enabled mod rewrite caching.
6.) Scroll until you see “Rejected User Agents”. Delete all entries there and make sure it will be empty. After that click “Save UA strings”.
7.) Leave the rest of the settings in the “Advanced” section at default settings. Don’t change or checked them unless specified in the above instructions.
8.) Click “Contents” tab and then click “Delete Cache”.
9.) Also click “Delete Expired”.
10.) Go to “Preload” tab. And put 10080 for values in “Refresh preloaded cache files every ____ minutes”. This will refresh the super cache once a week and this is recommended if you are writing content at least 3 times to once a week. This setting also works well if you are writing content at least once a month or more.
11.) You need to preload all post as well as check “Preload mode”.
10.) Click “Update Settings”.
11.) Click “Preload Cache Now”.
12.) WP-Supercache would then create static HTML version of all the posts in your blog and would be kept in the cache directory. These files are served to your blog readers instead of generating everything dynamically using PHP.
Checking for Correct WP Super Cache Implementation
1.) Logout from WordPress admin.
2.) Clear all browser history and cache.
3.) Open new tab in your browser.
4.) Visit your homepage URL.
5.) View the source code and go the last lines of the HTML source code.
6.) You should be able to see these lines (similar to this)
It is important that you see the lines “super cache”. This implies that the homepage is served from super cache static HTML files. You can try checking your other post HTML source code and it should be cached as well. Try to look at your template to see for template distortion, etc. It should be working well.
If it works well, try enabling Gzip compression by checking “Compress pages…” in advanced settings of WP Supercache. This assumes Gzip compression is not yet enabled for your blog.
If you see a result “BAD: not using gzip encoding”, then you can enable gzip encoding in the WP Super cache advanced settings. You need to repeat the test above to make sure the compression is working well for your blog. You can re-check your blog for compression using the tools provided previously.
This time you should see Compression = gzip in the HTML source code footer instead of “super cache”. Take note that super cache files are being served to your readers with gzip compression.
What if the optimal setting s doesn’t work well for your blog?
You can try the following work around:
1.) Use PHP Caching instead of Mod Rewrite.
2.) Try disabling GZIP compression via WP Super cache and enable it using third party plug-ins.
3.) Make sure you have correctly installed WP Super cache in your blog, re-read the installation instructions here and read the FAQ.
4.) Report any of the errors by commenting in this post or leaving a comment in the official WP Super cache page here.