W3 total cache plugin setting configuration tutorial

W3 Total cache is one of the best WordPress caching plugin.It has lots of option and may be bit complex for new beginner.The plugin should be properly configured to get max out of it.The best part is you can install it,configure it and forget.I have used W3 Total Cache for long and thought to write a detailed tutorial for new users.

W3 Total Cache compatibility check

After activating W3 Total Cache you can see new option Performance in your WordPress dashboard.Click on dashboard option under Performance tab.You can see Perform a compatibility check button on that page.Click on that button.You can see details about your server modules and WordPress configuration.This allows you to install (contact your hosting provider to install them for you if you are on shared hosting) these missing pieces.

You should not worry about pieces you are not going to require.Below is the compatibility check output for my localhost system.Your configuration will be more or less same.

Server Modules & Resources:

  •     Plugin Version:
  •     PHP Version: 5.4.6 (PHP5 required for Minify, Rackspace CloudFiles, Microsoft Azure support)
  •     Web functions: Installed (required for Self-hosted (FTP) CDN support)
  •     Multibyte String support: Installed (required for Rackspace Cloud Files support)
  •     cURL extension: Installed (required for Amazon S3, Amazon CloudFront, Rackspace CloudFiles support)
  •     zlib extension: Installed (required for compression support)
  •     Opcode cache: Not installed (not needed for shared hosting)
  •     Memcache extension: Not installed (not needed for shared hosting)
  •     HTML Tidy extension: Not installed (required for HTML Tidy minifier suppport)
  •     Mime type detection: Not installed (required for CDN support)
  •     Hash function: Installed (hash) (required for NetDNA / MaxCDN CDN purge support)
  •     Safe mode: Off
  •     Open basedir: Off
  •     zlib output compression: Off
  •     set_time_limit: Available
  •     mod_deflate: Not installed (required for disk enhanced Page Cache and Browser Cache)
  •     mod_env: Installed (required for disk enhanced Page Cache and Browser Cache)
  •     mod_expires: Not installed (required for disk enhanced Page Cache and Browser Cache)
  •     mod_headers: Not installed (required for disk enhanced Page Cache and Browser Cache)
  •     mod_mime: Installed (required for disk enhanced Page Cache and Browser Cache)
  •     mod_rewrite: Installed (required for disk enhanced Page Cache and Browser Cache)
  •     mod_setenvif: Installed (required for disk enhanced Page Cache and Browser Cache)

Additional modules

  •     New Relic
  •     PHP version: Supported
  •     Operating System: Not Supported.
  •     Web Server: Supported

WordPress Resources

  •     C:/EasyPHP/www/wordpress/.htaccess: OK (only if webserver is Apache)
  •     C:/EasyPHP/www/wordpress/wp-content: OK
  •     C:EasyPHPwwwwordpress/wp-content/uploads/2013/04: OK
  •     Fancy permalinks: /%postname%/ (You should get Enabled value for this item.In case you are getting Disabled for this option go to Settings — Permalinks from Dashboard.Change your Permalinks setting to any other setting from Default and Save the settings.If you do compatibility check again you will get Enabled for this option.)
  •     WP_CACHE define: Defined (false)
  •     URL rewrite: Enabled
  •     Network mode: No
READ  Responsive theme customization tutorial

W3 Total Cache Enable and disable Preview mode

The preview option makes you check the configuration without making any changes to your blog.This is important feature as it allows you to play with the options.You should not disable the preview mode until you have finalized your setting and checked whether it is working properly on your blog.To enable and disable preview mode follow below step

  • From your WordPress Dashboard go to option Performance –> General Settings
  • On that screen under the general tab you will see Preview mode.
  • If preview mode is enabled you will see three buttons (Disable,Preview and Deploy).
  • Click on the disable button to disable preview mode.You can use preview button to preview the configuration changes you have made.You can use deploy button to save the configuration changes.After deploying your site uses the configuration.So after deploying your changes you should disable preview mode.
  • If preview mode is disabled you will see enable button.You should ideally enable it before making configuration changes

W3 Total Cache General Settings

  • Enable Page Cache and Page Cache method as Disk enhanced for shared hosting as well as VPS
  • Enable Minify,Minify mode to auto (minify mode manual is better but is suggested for advanced users.I have given some details for manual mode below),minify cache method disk for shared and APC for VPS.HTML minifier value default (HTML tidy is better but have issues with themes like Twenty Twelve),JS minifier value JSMIN is fine,CSS minifier value default is fine or you can use CSS tidy.
  • Enable Database cache and set it to disk for shared and APC for VPS.
  • Enable object cache and set it to disk for shared and APC for VPS.
  • Enable browser cache
  • Do not enable CDN for shared hosting.But in case you want to enable read the CDN section in details.
  • W3 Total Cache and CloudFlare is covered in detail below.

W3 Total Cache Page Cache

Under General Tab

  • Enable these options — Cache front page , Cache feeds: site, categories, tags, comments , Cache SSL (https) requests (only of you are using HTTPS) , Don’t cache pages for logged in users
  • Disable these options — Cache 404 (not found) pages , Cache requests only for localhost hostname.This post describes in detail reason of not caching 404 pages.
READ  Upgrade WordPress manually after automatic upgrade failed

Under Cache preload Tab

  • Enable these options — Automatically prime the page cache , Prime post cache on publish.
  • Enter your XML sitemap URL in text box Sitemap URL.

Leave all the options in other tabs on this page to their default and save the page.

 W3 Total Cache Minify

HTML and XML tab

  • Enable all the options

JS tab

  • Enable the option and embed type non blocking async

CSS tab

  • Enable the option.

If minify auto mode selected

If you have selected Minify auto mode then you will see Help button on this page.You should click on it.It will show all the JS and CSS files your webpage uses.Check all the JS and CSS files from your website (leave ads and third party JS and CSS files) and embed them above </body>.

W3 Total Cache Database cache and Object Cache

There is no need to make any changes on these settings.But in case you have little traffic then you can make the values 180 and 3600 larger.This will keep your cached data for long time.

W3 Total Cache Browser cache

Enable these options in all tabs

  • Set Last-Modified header
  • Set expires header
  • Set entity tag (eTag)
  • Set W3 Total Cache header
  • Disable cookies for static files
  • Do not process 404 errors for static objects with WordPress

Disable these options in all tabs

  • Set cache control header
  • Prevent caching of objects after settings change

W3 Total Cache User Agent Groups

Disable both the groups if you are using plugins like wptouch.In case you are not using wptouch or similar plugins then do not enable these options.

W3 Total Cache CDN

You should take care of below points before using self hosted CDN functionality on shared hosting

  1. If you have limited bandwidth(5 GB to 10 GB) allowed under your hosting plan then this option should not be used.The reason is Bandwidth allowed is sum of total FTP and HTTP traffic (along with other ones) and FTP is used to refresh your CDN.This consumes your bandwidth.
  2. If no sub domains are allowed under your hosting package then you can not use this feature.
  3. Export changed files automatically option of W3 Total Cache CDN should not be enabled.This consumes much bandwidth.Also you should export files manually if this is disabled.

If you are sure that you want to use W3 Total Cache CDN then follow below steps

  • Create a subdomain.If you have trouble creating subdomain then read this tutorial
  • Create an FTP account dedicated for this subdomain (you can use your existing account but this is preferred way). Read this tutorial to achieve this.
  • Get the FTP user name and FTP server name.If you have trouble getting these information then read the tutorial above.
  • Now Log into your WordPress dashboard using administrator account.
  • Go to option Performance –> General Settings and Enable CDN and Choose CDN type as Self Hosted / File Transfer protocol upload.
  • Go to CDN option under the Performance.
  • On the screen displayed under the General section enable all the check boxes.
  • On the Configuration section Enter the FTP hostname (FTP server name you noted above),Enter FTP user name (noted above),Password corresponding to the FTP user name,mention FTP path as / and Set SSL support to Auto.On replace site hostname option field write subdomain you created above.After filing this information you should Test the FTP server clicking the button Test FTP server.
  • Move on to the Advanced section and enable all check boxes.
  • On the custom file list write the directories in which you have custom files (in general term static files like pictures,videos,downloads etc). For example if you store your images under in image directory then on custom file list you have to write image/*. This way you can list all the files and folders in this field.
READ  Improve TTFB Time to first byte tutorial

W3 Total Cache CloudFlare

CloudFlare is free content delivery network which speeds up your website a great deal and also helps in security.Before configuring this part read this tutorial and setup CloudFlare for your website.After finihsing last tutorial follow below steps

  • Enable CLoudFlare and enter you CloudFlare email address and API key.
  • Set the security level to medium or low.
  • Disable RocketLoader in case you are using Google Adsense.for more details read this post.
  • You can disable minification (you can enable it but in that case disable minification on W3 Total Cache side).
  • Keep Development mode to off.

What’s Next

Above mentioned setting should work for most of the sites.But there is option of fine tuning it depending upon your configuration and site traffic.You can post your queries and I will try to help you.

You can face some issues while using W3 Total Cache.One of the issues is redirection issue which is described in details in this post along with solution.

Consider sharing the post if you found this useful.


24 comments W3 total cache plugin setting configuration tutorial

  1. Excellent reference tutorials. All visits to the site are educative.

    I use twentyfourteen-child theme.
    Permalinks settings cannot be saved to /%postname%/, but remains stuck on Post name: ‘sample-post’. However, surprisingly it does not affect navigation.

    In Page Cache sitemap URL do we need to include Udinra All Image Sitemap.

    Thanks for the tutorials,

  2. Hi Udinra
    I want to say THANK YOU! I have spent 2 days searching all over the web trying to figure out my Cloudflare with W3 Total Cahe settings and Your site is the first one to “truly” explain it in detail.
    Thank You again

  3. When w3 total cache plugin is enabled i m not able to view my xml sitemap so i deactivate w3 total cache plugin, I m using wordpress seo plugin

  4. Hi Esha,
    Great post i have an issue before using w3 total cache my google page speed is 86 and after using it it’s 91, but i am facing some issue with my sitemap so i deactivate it after deactivation page speed is 72 why it decrease my page speed?. site address thanks in advance.

  5. The problem with Responsive design is that you are loading same number of resources on desktop and mobile.So mobile pages are also heavy like desktop pages.This makes the pages load slow on mobile

  6. Thank you, great explanation and improvement of my website.. The front page is now really quick, however when I go to individual articles they are quick on the pc, but still rather slow on mobile. Is there an additional setting that I can use to optimise the mobile site?


  7. This means those plugins are not compatible with W3 Total Cache.You can try manual mode.In manual mode do not enable minify CSS or JS for these plugins..

  8. I tried the automatic minify option again and this time the css worked but a couple of essential plugins stopped working (Ajax event calendar and comprehensive google maps). I would like to get this option to work as my google site speed increased from 71 to 96.

  9. 1.While using Automatic minify option use default for CSS minify and HTML minify..and check whether the issue is resolved.
    2.Third party CSS and JS are either advertising or social widget files used on your site.You should not minify them (do not enable check boxes for them).Embed the code before

    I will suggest trying first option (it is easier).

  10. This is a great article. The best I have seen. I had a problem with the minify automatic mode however. When this is activated, the site css completely falls apart. So I need to use the manual mode. My question is on the help page, what are third party js and css files? Do plugins fall into this category? And if so, do I still check the add box but just embed before ?

  11. glad to know it helped you..On VPS you have luxury of utilizing full power of W3 Total cache.

  12. Thanks, i have implemented inline JS minification and also JS using non-blocking using async. One more thing, i am using sharing plugin, which is making many http requests, around 27-30 per page load, wich plugin u r using for sharing? Ur site loads in less than a second.
    Thank u

  13. Thank you, this was very helpfull and it shure helped me get a better insight on how to configure W3 to my vps.

  14. if you are using auto option of minify then you need not worry..It will skip those (only minify JS from your site)..but in case you are using Manual minify mode then you will have to skip those JS file from minify..do let me know if this helps

  15. Hello, thanks for great tutorial,
    i had one doubt,
    Under minify > HTML and XML> inline JS minifacition.
    and minify > JS > enable.
    so if we enable minifying java script, will it minify adsense and other ads which are written in java script also?

Leave a Reply

Your email address will not be published. Required fields are marked *