Category: Wordpress

w3-total-cache optimal settings

Configuring W3 Total Cache – General Settings

 

W3 Total Cache creates a new menu entry called Performance in WordPress dashboard. The options that we’re looking for are under Performance > General. You’ll notice that this page has an overwhelming number of settings for a caching plugin (and a whole lot more if you’re into advanced stuff). Each setting is placed inside a box – called modules. I’ve discussed each of these modules with relevant screenshots. If you get stuck or are uncertain about a particular setting, simply follow the screenshots.

W3 total cache general settings module

The first module you’ll find is General. I’d recommend not to enable the all the caching options using the toggle checkbox. You might turn on settings that aren’t required (or even supported by) your host – which would inadvertently slow down your website. However, if you want to quickly disable all the modules, this toggle checkbox comes in handy! Before we proceed further, if you’re unfamiliar with the terms ‘page cache’ or ‘database cache’, I would recommend readingHow WordPress Caching Works.

Page Cache Module

W3 total cache page cache

The second module we’re going to configure is Page Cache. The Page cache method depends on your hosting environment. If you’re using a shared host, Disk: Enhanced is the best option. However, if you’re using a dedicated or virtual server and you have APC (or any other form of Opcode caching installed), you should select the respective option.

Minify Module

W3 total cache minify module

The Minify module compresses the CSS and JavaScript files your theme uses, by removing unnecessary lines of code like comments and whitespaces. This reduces the filesize by ~10% which results in a faster site. Under Minify cache method you should select the appropriate option based on your server.

Other Caching Modules

W3 total cache object cache

The next two modules are Database Cache and Object Cache. Enable each of them and change their caching method to the one best fit to your hosting environment – just like you did underPage Cache and Minify.

W3 total cache browser cache

The last module that we want to enable is Browser Cache. Once you’ve enabled them, click onSave all Settings. That should do it! W3 Total Cache is now enabled in your server. We will now take an in-depth look into two specific modules – Page Cache and Browser Cache. The rest of the modules’ default values are just fine.

Page Cache Settings

w3 total cache advanced settings - page cache

The Page Cache settings can be found under Performance > Page Cache. The settings here are fairly self explanatory. I’ve enabled a couple of them – specially Don’t cache pages for the following user roles. This ensures that when an author is editing a post, he/she will able to view the latest version and not the one from the cache.

Preloading the Cache

 

seconds
The number of seconds to wait before creating another set of cached pages.

Limit the number of pages to create per batch. Fewer pages may be better for under-powered servers.

A compliant sitemap can be used to specify the pages to maintain in the primed cache. Pages will be cached according to the priorities specified in the XML file. Due to its completeness and integrations, WordPress SEO is recommended for use with this feature.

By default, W3 Total Cache caches a page when it is first requested. You also have the option to pre-generate copies of all the posts/pages. This way, regardless of when a visitor requests a page, the cache is ready and the page is served in the lowest possible time.

You should configure the cache preload settings based on your hosting environment and the amount of traffic your website receives.

  • The cache Update interval directly affects server resources – lower the time interval (i.e. higher the frequency), greater the server resource consumed. People on shared hosting servers should be very careful with this setting. Set a high enough frequency and you might just get your account suspended for abuse of server resources. A safe cache preload interval is one hour – i.e. 3600 seconds.
  • If you’re unfamiliar with the Sitemap URL, install Google XML Sitemaps. It’s super easy to use and is in fact, a must-have plugin.
  • Finally, you want to enable the last option which will trigger a cache preload operation when a post/page is published.

Browser Cache Settings

w3 total cache advanced settings - browser cache

Click to rate this post!
[Total: 1 Average: 5]

wp-super-cache without compression optimal settings

Step a. Set General Settings

  1. Check box next to “Cache hits to this website…”
  2. Select button next to “Expert”
  3. Check box next to “304 Not Modified browser caching”
  4. Check box next to “Don’t cache pages for known users”
  5. “Cache rebuild” & “Extra homepage checks” should already be checked, leave them that way.
  6. Check box next to Mobile device support. (External plugin or theme required. See the FAQ for further details.)
  7. (Recommended)
  8. Select “Update Status” button.

Step b. Set Mod_Rewrite Rules

  1.  Select “Update Mod_Rewrite Rules” in the yellow box.

Step c. Set Garbage Collection

  1. “Expiry Time & Garbage Collection” and enter “3600” in the box, then select “Change Expiration”

Step d. Under tab Preload set:

Refresh preloaded cache files every minutes. (0 to disable, minimum 30 minutes.)

Preload mode (garbage collection only on legacy cache files. Recommended.)
Preload tags, categories and other taxonomies.
Send me status emails when files are refreshed.
Many emails, 2 emails per 100 posts.
Medium, 1 email per 100 posts.
Less emails, 1 at the start and 1 at the end of preloading all posts.

 

Explanation of the Options Selected

Cache hits to this website…

Enables caching

Use mod_rewrite to serve cache files

Fastest caching method, uses mod_rewrite rules in client’s .htaccess file

 

304 Not Modified browser caching

Indicates to the client’s browser whether a requested file has been modified or not (see: http://www.addedbytes.com/for-beginners/http-status-codes/ or elsewhere for more info on that apache code)

Don’t cache pages for known users

This prevents logged-in users from being served cached pages and is the default for almost every caching plugin out there.

Expiry Time & Garbage Collection

The default setting will allow cache files to age 1 hour (3600 seconds) prior to being removed which is ideal. This setting can be increased for sites that do not have many posts (1,000 or less ) if you do not update your content often. If you have a very large amount of posts ( 25,000+ ), a lower setting around 1800 may be more viable to prevent stat/CPU issues due to the amount of files being created.

Rejected User Agents

It is recommended that you do not remove the default user agents from the list, to prevent bots from caching content and pages not normally seen by your visitors. (For example, if you have a calendar, a real visitor may only browse months close to now, but a bot will index every month forever as if it is a different page. Caching these pages real visitors are unlikely to visit wastes resources.)

 

Click to rate this post!
[Total: 0 Average: 0]

Basic WP .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Click to rate this post!
[Total: 0 Average: 0]