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: 0.9.2.8
- 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)
- New Relic
- PHP version: Supported
- Operating System: Not Supported.
- Web Server: Supported
- 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
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.
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
- Enable the option and embed type non blocking async
- 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
- 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.
- If no sub domains are allowed under your hosting package then you can not use this feature.
- 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.
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.
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.