You are on page 1of 46

SPEED UP WORDPRESS

W3 TOTAL CACHE -PLUGIN FOR WORDPRESS:


INSTALLATION AND CONFIGURATION GUIDE
by

Antti Kokkonen

http://zemalf.com

zemalf.com | Installation and Configuration Guide by Antti Kokkonen 1


PREFACE

This guide focuses on the most important optimization tweak one can do to a
WordPress blog - installing and configuring the W3 Total Cache plugin.

There are other optimization steps and ways to increase the site speed, but if
you could only do one thing, this would be it.

The W3 Total Cache is the best caching plugin there is for WordPress – Best,
because it gets the best results and has all the needed options included, like
minifying, so it‘s not just Page Cache, like WP Super Cache is.

 This guide will show you how to install and configure it on your
self-hosted WordPress blog, and make your blog work better and
faster.
 This guide is MASSIVE (40+ pages), but don‘t let that scare you, I just
wanted to cover it all with screenshots and step-by-step
instructions. It‘s not hard, it won‘t you too long, and your blog will
thank you later.

I made this guide because I see too many WordPress blogs that are so slow
that it‘s embarrassing - People are leaving the blogs before the text loads! I
made this guide, because it doesn‘t have to be like that - speeding up
WordPress is easy, so there is no excuse!

I hope you enjoy this guide and speed up your blog with the instructions in it…

Good speed,

Antti Kokkonen – http://zemalf.com – http://twitter.com/akokkonen

p.s. This guide is 100% free, and freely available at at my blog and my
Scribd - http://www.scribd.com/anttikokkonen - you may NOT sell this guide,
but you SHOULD pass the info on and tell your WordPress using blogging
buddies about this – read the guide, use it, share it, embed it on your blog,
share the love!
2 Preface | zemalf.com
INTRODUCTION TO SITE SPEED

To speed up WordPress, or make any website load faster, we need to

1. Load less stuff


2. Load smaller stuff
3. Deliver the stuff in an optimal way

"80% of the end-user response time is spent on the front-end. Most of this
time is tied up in downloading all the components in the page: images,
stylesheets, scripts, Flash, etc. Reducing the number of components in turn
reduces the number of HTTP requests required to render the page. This is the
key to faster pages."

– Source: Best Practices for Speeding Up Your Website by Yahoo!

In addition to loading less stuff, when we optimize the stuff we have left to
load and deliver that stuff to the reader in an optimal manner, we'll have a fast
blog. It's really as simple as that.

Each of the three things can be broken down into actions:

 Load less stuff


 Remove stuff that is not needed
 Combine the stuff that's not removed into fewer files
 Load smaller stuff
 Optimize and minify the stuff
 Crunch and compress everything
 Deliver the stuff in an optimal way
 Optimize loading
 Optimize caching

You need to remove stuff that is not really needed. After the cleanup, the rest
is cakewalk. In fact, W3 Total Cache does exactly this. We‘ll have additional
steps, like optimizing images, but W3TC truly is a TOTAL cache solution.

zemalf.com | Introduction to Site Speed 3


HOW TO SPEED UP WORDPRESS

On WordPress, we can achieve fast loading pages very easily, by cleaning up


the blog and using optimal settings and free plugins.

The whole process is explained into detail in the WordPress Speed Challenge, a
series of posts & steps that help people to speed up their WordPress blogs.

Speeding up WordPress is a step-by-step process. The 7 initial steps are


outlined in the WordPress Speed Challenge, beginning with analysis of the blog
performance and ending with post-analysis and reviewing the results - in
between of the analysis, there are 4 optimization steps, which do the work
and make a blog faster:

1. (Automatically) backup and optimize the WordPress database


2. Use the WordPress .htaccess rules (W3TC will handle caching rules)
3. Install and configure W3 Total Cache –plugin (this guide)
4. Optimize images for the web (and automate most of it with WP
Smush.it).

In addition to these 4 steps, you should cleanup the blog, removing


unnecessary scripts and widgets, and using well optimized WordPress theme.

4 How to Speed Up WordPress | zemalf.com


Installing and configuring W3 Total Cache is one of the 4 initial optimization
steps, and it‘s also the most important one, which was the result why this
guide was created in the first place – putting all this into a blog post would
have been too much – over 40+ pages, screenshots and all - so separate guide
worked better.

(W3 Total Cache is a plugin that is still evolving, so it‘s possible that the
screenshots may look a bit different, but the options and settings should
remain.)

All my WordPress optimization materials are available at http://zemalf.com


and at my Scribd profile: http://www.scribd.com/anttikokkonen.

zemalf.com | How to Speed Up WordPress 5


ABOUT W3 TOTAL CACHE –PLUGIN

W3 Total Cache is a WordPress plugin created by (a web design company) W3


EDGE: http://www.w3-edge.com/

The fastest and most complete WordPress performance optimization plugin.


Trusted by many popular sites — W3 Total Cache improves the user
experience of your blog by improving your server performance, caching every
aspect of your site, reducing the download time of your theme and providing
transparent content delivery network (CDN) integration.

Benefits:

 At least 10x improvement in overall site performance (when fully configured: Grade A in YSlow or significant
Google Page Speed improvements)
 Improves "site performance" which affect your site's rank on Google.com
 "Instant" second page views (browser caching after first page view)
 Reduced page load time: increased visitor time on site (visitors view more pages)
 Optimized progressive render (pages appear to render immediately)
 Improved web server performance (sustain high traffic spikes)
 Up to 80% bandwidth savings via minify and HTTP compression of HTML, CSS, JavaScript and feeds

Features:

 Compatible with shared hosting, virtual private / dedicated servers and dedicated servers / clusters
 Transparent content delivery network (CDN) integration with Media Library, theme files and WordPress itself
 Caching of (minified and compressed) pages and posts in memory or on disk
 Caching of (minified and compressed) CSS and JavaScript in memory, on disk or on CDN
 Caching of feeds (site, categories, tags, comments) in memory or on disk
 Caching of search results pages (i.e. URIs with query string variables) in memory or on disk
 Caching of database objects in memory or disk
 Minification of posts and pages and feeds
 Minification (combine and remove comments / white space) of inline, embedded or 3rd party JavaScript (with
automated updates)
 Minification (combine and remove comments / white space) of inline, embedded or 3rd party CSS (with
automated updates)
 Browser caching of CSS, JavaScript and HTML using future expire headers and entity tags (ETag)
 JavaScript grouping by template (home page, post page etc) with embed location management
 Non-blocking JavaScript embedding
 Import post attachments directly into the Media Library (and CDN)

Source: http://wordpress.org/extend/plugins/w3-total-cache/

6 About W3 Total Cache –plugin | zemalf.com


ANALYZING BLOGS PERFORMANCE

Before you move on into installing and configuring the W3 Total Cache plugin
for your WordPress blog, you should know what the performance of your blog
is before you optimize anything...

To do this, go to the WordPress Speed Challenge Step 1

 Analyze your blogs performance and write the results down:


 Go to: http://zemalf.com/1428/analyze-blog-performance/
 And finish the action steps

Blog performance analysis means

 checking the load time of your blog


 analyzing blogs loading with analysis tools
 using free analysis tools to get easy to understand metrics

You can use free tools and websites like Pingdom Tools, WebPageTest.org and
Firefox –addons like YSlow, Google Page Speed and Firebug.

1. Check the Total Loading Time with Pingdom Tools,


2. the YSlow grade and score, and
3. The Page Speed score!

With the page loading times, YSlow and Page Speed scores written down, you
now have a baseline to compare the results after installing W3 Total Cache.

This is important, do not skip the analysis part, because there‘s a chance that
your hosting provider is not well suited for WordPress blogs and W3 Total
Cache will not improve your results.

Analyzing the performance before and after will ensure you will see
immediately if that‘s the case, and you can reverse the changes you made,
e.g. use different settings on W3 Total Cache.

zemalf.com | Analyzing Blogs Performance 7


HOW TO INSTALL W3 TOTAL CACHE

Installing W3 Total Cache is as simple as installing any other WordPress plugin.


With its default settings it will speed up your blog by enabling Page Cache
(similar to WP Super Cache), but where W3TC truly shines is the additional
options, like compression and minifying. Follow the step by step instructions
and you‘ll be fine.

Backup your blog before you begin, and be ready to come back to the earlier
configuration steps and try different settings if you have problems after
installing and configuring it.

If you run into problems with the guide, visit my blog at http://zemalf.com/,
send me a message using my contact form or leave a blog comment on one of
the WordPress optimization posts.

HOW TO UNINSTALL WP SUPER CACHE

Each WordPress blog should use a cache plugin, and for most popular is the
WP Super Cache. WP Super Cache is a great plugin, but W3 Total Cache does
more than the Super Cache, and we can‘t use both together, so we choose the
best option – W3 Total Cache. If you‘re using WP Super Cache, or any other
caching plugin, you need to uninstall that first.

You can find instructions on how to uninstall WP Super Cache here:

http://zemalf.com/1442/how-to-uninstall-wp-super-cache/

Or from the plugin page at WordPress.org:

http://wordpress.org/extend/plugins/wp-super-cache/other_notes/

8 How to install W3 Total Cache | zemalf.com


HOW TO INSTALL THE W3 TOTAL CACHE

1. Go to the Dashboard, e.g. http://example.com/wp-admin/, login if needed

2. Click 'Plugins'

3. Click 'Add New'

4. Type "W3 Total Cache" to Search

5. Hit 'Search Plugins'

6. Locate 'W3 Total Cache' (should be at top), and hit 'Install Now'

zemalf.com | How to Install the W3 Total Cache 9


7. "Are you sure want to install this plugin?" - Click OK

8. You should see 'Succesfully installed the plugin W3 Total Cache x.x.x.x'
(x.x.x.x. being the version) at the top...

9. Click 'Activate Plugin'

10. You'll see 'Plugin activated.' at the top

And now you're ready to start configuring the W3 Total Cache.

10 How to Install the W3 Total Cache | zemalf.com


W3 TOTAL CACHE - BASIC
CONFIGURATION

For the most part, the DEFAULT settings of W3 Total Cache work fine, but as
mentioned, the default settings only enable the Page Cache.

The somewhat tricky part are the Minify Settings (the advanced settings, like
CDN settings, we don‘t even need right now).

I‘ll take you through all the settings, so you know what they do, even if the
settings themselves are OK already.

GENERAL SETTINGS

Let‘s begin with the General Settings…

 From the Dashboard


 Go to ‗Performance‘
 (1.) You'll see message on top saying that:
o "The Preview mode is active"

The General Settings –page in the W3 Total Cache settings should be open…

GENERAL SETTINGS – GENERAL

The default settings in W3TC General Settings don‘t necessarily need to be


changed, but it‘ll be useful for you to go through them anyway.

 the 'Deselect this option to disable all caching functionality.' option


seems to be BROKEN, just ignore it, even if its unchecked by default -
otherwise, we‘d leave that ON (checked)

zemalf.com | W3 Total Cache - Basic Configuration 11


GENERAL SETTINGS - PAGE CACHE

 (2.) Page Cache: (checked) Enable


 (3.) Page Caching Method: Disk (enhanced)

The default option ‘Disk (enhanced)’ is perfect, but if W3TC does not seem to
work well for you, choose ‘Disk (basic)’.

12 W3 Total Cache - Basic Configuration | zemalf.com


GENERAL SETTINGS – MINIFY

 (4.) - Minify: (checked) Enable (4.)


 Minify Caching Method: Disk

GENERAL SETTINGS - DATABASE CACHE

 (5.) Database Cache: Disabled ('Enable' unchecked)

After everything else is done, you can try if enabling and using Disk
cache speeds up your blog. On some hosts, this will end up slowing your
blog.

If you're on non-shared hosting and can use Opcode cache or memcache -


enable the Database Caching, as caching will speed up your blog in that case.

zemalf.com | W3 Total Cache - Basic Configuration 13


GENERAL SETTINGS – OBJECT CACHE

 (6.) - Object Cache: Disabled ('Enable' unchecked)


 You can play around with Database Cache and Object cache if you have
opcode and/or memcache in your VPS/dedicated server(s).
 Feel free to test the 'Disk' -option after you’ve done the rest of the
guide, but in most cases, the benefit is minimal. Before you test
however, finish the default configuration first.

GENERAL SETTINGS - CONTENT DELIVERY NETWORK

 (7.) Content Delivery Network: Disabled ('Enable' unchecked)

CDN is OPTIONAL, because they cost a bit, but you can very easily set
(sub)domain and use the 'Self-hosted / FTP' option, or configure W3TC to use
your Content Delivery Network (CDN) like MaxCDN if you want:

 Read: How to setup WordPress CDN with W3 Total Cache and MaxCDN

Note: Some people suggest using a sub domain to "fake" CDN with W3 Total
Cache, which is OK, but using true CDN is a much better solution, and the sub-
domain solution is really not worth the trouble in the end.

14 W3 Total Cache - Basic Configuration | zemalf.com


GENERAL SETTINGS – BROWSER CACHE

 (8.) Browser Cache: Enabled ('Enable' checked)


 This adds the caching and other rules to the .htaccess -file that W3 Total
Cache needs.
 Make sure your WordPress htaccess rules are OK. W3 Total Cache
handles caching rules, but for WordPress security, it‘s good to tweak the
rules a bit. Check the details here: WordPress .htaccess rules.

 (9.) There is no need to touch the Support Us or the Debug section, but
if you're a good sport, add W3 Total Cache link to your blogroll, tweet
about the plugin (and tell your followers about this guide to help them)
and at some point, rate the plugin at WordPress.org
 (10.) At the bottom of the General Settings, you can Export/Import the
configuration, and if everything goes wrong...
zemalf.com | W3 Total Cache - Basic Configuration 15
 (11.) You can Restore Default Settings (DO NOT touch it now!)
 (12.) If you want to unclutter your Dashboard, disable the news widget
(uncheck the 'Enable dashboard news widget' -option)

If you changed any settings on General Settings, click ‘Save Changes’ before
moving on.

16 W3 Total Cache - Basic Configuration | zemalf.com


PAGE CACHE SETTINGS

NOTE: In most cases, you don't have to change anything on the Page Cache
settings = Page Cache settings are OK by default. But let's go through the
configuration...

PAGE CACHE SETTINGS - GENERAL

 Enable (checked) - Don't cache pages for logged in users


 Enable (checked) - Cache home page
 Enable (checked) - Cache feeds
 Disable (unchecked) - Cache URIs with query string variables
 Disable (unchecked) - Cache 404 (not found) pages (this will help
performance, but by default, it's not needed. Also: it's better to avoid
404s by fixing broken links and using 301s instead)

zemalf.com | W3 Total Cache - Basic Configuration 17


PAGE CACHE SETTINGS - ADVANCED

No need to touch these.

PAGE CACHE SETTINGS - CACHE PRELOAD

Now this is interesting, with Cache Preload, you can automatically "fill the
cache", using a XML sitemap. This means serving pre-cached pages to all
visitors, even if a page has not been visited recently.

It's OK to leave this disabled, and keep it disabled if you run into performance
problems when the preload activates, or lower the number of 'Pages per
interval'.

 Enable (checked) - Automatically prime the page cache


 Update internal - 907 (I like to use irregular number like this, so the
update does not always hit certain hour and minute)
 Pages per interval: 7 (increase/decrease as needed)
 Sitemap URL: Your blogs sitemap.xml URL, e.g.
http://example.com/sitemap.xml

If you changed any options on the Page Cache Settings, remember to click
'Save changes'

18 W3 Total Cache - Basic Configuration | zemalf.com


MINIFY SETTINGS

 The Page Cache alone will speed up your blog a lot (if you want, you can
go give it a go via Pingdom Tools right now if you want), but the minify
part is what separated W3 Total Cache from the competition.
 With minifications, we'll be able to take all CSS- and JavaScript -files in
your blog and combine them into one - automatically - and minify that
one file to be as small as possible.
 Depending on how bloated your blogs theme and setup is, this can peal
seconds from the loading time (and it'll increase YSlow and Page Speed
scored quite a bit too)

Skip the General, HTML and JavaScript for now, and scroll to...

MINIFY SETTINGS - CASCADING STYLE SHEETS

CSS Minify Settings:

 Enable: Enable (checked)


 Disable: Combine only (unchecked)
 Enable: Comment Removal (checked)
 Enable: Line break removal (checked)

If you run into problems with badly coded CSS, try disabling the Comment-
and Line break removal. Well coded CSS will still work, bad ones might get into
problems.

zemalf.com | W3 Total Cache - Basic Configuration 19


CSS FILE MANAGEMENT

Theme: The active theme should be chosen, but you can set configurations to
all installed themes here (even for non-active ones, in case you ever activate
them).

1. Open another browser window or tab, and open the blog (not admin
area, but the front page for example).
2. Open the page source (right-click, show page source).
3. Open Find (e.g. CTRL+F or from menu: Edit > Find)
4. Search for ".css" (without quotes)
5. Copy the full URL of the first .css-file you find, e.g.
http://example.com/wp-content/themes/yourtheme/style.css (do not
copy this URL, you must get it from YOUR BLOGS page source)
6. Go back to the window/tab with W3 Total Cache settings and the Minify
Setting -page, click 'Add a style sheet' under Cascading Style Sheets...
7. Paste the .css -file URL in, unless the css-file is specific to certain
page/template, choose 'All Templates'. Just in case, click 'Veriry URI' to
see that the URL is correct
8. Go back to the page source, hit next on the find to locate the next css-
file. Copy the URL to the W3 Total Cache, Verify.
9. Repeat until you've added all css-files from the page source to W3TC.

20 W3 Total Cache - Basic Configuration | zemalf.com


Note: If there is "version number" like "?ver=2.4.1" in the CSS-files URL,
remove it, for example: /styles.css?ver=2.4.1 - would go to W3 Total Cache
as… /styles.css - This way, W3TC will pick up the CSS, even if the
plugin/theme updates and the CSS-version changes

After done, click 'Save changes' (Ignore any notifications about emptying
caches on top for now)

After saving changes, W3 Total Cache might remove the HTTP:// from the
URLs, but that's normal. If you have WordPress installed on a directory (not
the root), click 'Verify' again to ensure the file works.

zemalf.com | W3 Total Cache - Basic Configuration 21


MINIFY SETTINGS – ADVANCED

This will affect the expiration times of cached objects. According to guidelines
from Google and Yahoo, we want it to be over a month, so use these settings
instead of default 86400.

 Update external files every: 3628800 seconds


 Garbage collection interval: 216000 seconds

For high traffic sites, lower the Garbage collection to 86400, or just leave it
there by default.

If you manually edit/create your .htaccess -file and don't use W3TC's Browser
Cache, the 'Update external files every' won't have an effect - but do set it to
3628800 seconds anyway.

Save Changes.

MINIFY SETTINGS - JAVASCRIPT

The process is similar to adding the CSS-files, but the problem is that many
plugin- and theme-authors are not very good JavaScript coders, so they code
can't handle minification.

 Enabled: Enable (checked)


 Disabled: Combine only after <head>
 Disabled: Combine only after <body>
 Disabled: Combine only before </body>
 Enabled: Comment removal
 Enabled: Line break removal

22 W3 Total Cache - Basic Configuration | zemalf.com


JS FILE MANAGEMENT

The recommendation is to place JavaScript in the Footer, so that's what we'll


do, even if you found the .js URL in the header.

For performance, it's better to Embed JavaScript to the bottom of the


page = Embed before </body> and use the "Non-blocking" -option

Non-blocking can be used if the functionality of that script is not needed when
loading the page, but only after the page is loaded. (In general, interface
scripts can be non-blocking, and scripts that modify the content usually need
to be "blocking")

If a script doesn't work correctly when embedded to the footer (before


</body>), embed it to the same location you found it, e.g. Embed script
located originally in the <head>, in <head> = Embed in <head>.

If a script is only used/needed on certain pages, use the Template selector to


choose the correct template from your theme, e.g. Page for page.php,
Category for category.php, etc.

zemalf.com | W3 Total Cache - Basic Configuration 23


Note: to avoid problems: DO NOT ADD AdSense, Chitika or similar advertising
code to W3TC.

1. Open your blog to a separate tab or window.


2. View the page source
3. Look for JavaScript URLs (use search for '.js')
4. Copy the .js-file URLs into W3 Total Cache:
5. Choose Template
 If the JavaScript is not needed on every page of your blog, you can
choose the template from your theme to use.
 For example, if a JavaScript is only needed on individual blog
posts, choose 'single'. If you are unsure what to do, just use
the ‘All Templates’ (the JavaScript will be loaded on every page).
6. If the script does not need to be loaded before content, choose (Non-
blocking) 'Embed before </body>'. If the JavaScript absolutely needs to
be in <head>, choose that (remember the rule: css to header,
JavaScript to footer).
 This will make the JavaScript load after the page is loaded and not
block the page load in case it fails.
 If the JavaScript needs to 'block' the page load (e.g. changes in the
actual content), choose (Blocking) 'Embed before <body>'.
7. Repeat for all the JavaScript URLs in your blogs page source.
8. Verify the URLs to ensure the script URLs were copied OK.

After you're done adding all JavaScript files you want to minify into
W3 Total Cache, click ‘Save changes’

(Ignore the notification about emptying any caches on top for now).

Test your site functionality before enabling the HTML minify! If you're on
Preview-mode, test your site after 'Deploy' and change configuration if needed.

24 W3 Total Cache - Basic Configuration | zemalf.com


Disable 'Comment removal' and 'Line break removal', if you're having
problems. And if everything else fails, remove JS-file from W3TC (and seriously
consider getting rid of that poorly coded script!!)

Did you have a lot of CSS- and JavaScript -files to go through? Maybe
you're running a few unneeded plugins, widgets and external scripts?
Do you really need them all? Remember - best performance
optimization trick is to remove stuff.

MINIFY SETTINGS – GENERAL

 Enable: Rewrite URL structure (checked)


 Enable: Automatically upload mofified files (checked)

Minify error notification: Enable this to get error notification if something goes
wrong.

zemalf.com | W3 Total Cache - Basic Configuration 25


MINIFY SETTINGS - HTML

Note: After enabling HTML, your page source will become somewhat difficult to
read, so adjust CSS- and JS-settings before enabling this.

And if you ever need to look into your blogs source, disable HTML minifying
then, so leave HTML minification as the last, so you can setup everything else.

Best Performance:

 Enable: Enable (checked)


 Disable: Don't minify feed (checked)
 Enable: Inline CSS minification (checked)
 Enable: Inline JS minification (checked)
 Enable: Line break removal (checked)

Best compatibility with HALF-ASS coding on the theme/scripts:

 Disable: Enable (unchecked)

Add stuff to ignore-field as needed (Advanced stuff)

Save changes..

ADVANCED MINIFY SETTINGS

The Advanced Minify Settings are what they say they are - Advanced. Default
settings are OK, or like this:

 Update external files every: 216000 seconds


 Garbage collection interval: 86400 seconds

'Save changes'

26 W3 Total Cache - Basic Configuration | zemalf.com


DATABASE CACHE AND OBJECT CACHE –SETTINGS

Skip Database Cache- and Object Cache settings, as those are probably
disabled + the default options work OK, even if you do have opcode-
/memcache running on your VPS or dedicated server.

For blogs on shared hosting: after finishing the guide, you can TRY if the
Database Cache and/or the Object Cache with the ‘disk’ option works
on your host and blog. If the disk ―responds‖ slower than the database, these
caches don‘t help. On the other hand, if the disk works fast, Database Cache
and Object Cache (or just one) can speed up the site a lot.

You might need to upload object cache file from W3TC plugin dir to wp-content
when you enable it. Use a FTP client to copy the file.

BROWSER CACHE

The browser cache settings will change rules in your .htaccess-file if you have
the Browser Cache enabled.

Advanced users probably want to tweak their .htaccess manually, but this is an
excellent way for non-techies to get .htaccess-based browser cache set-up.

Go through the settings, and set'em like this:

BROWSER CACHE – GENERAL

Change General settings for Browser cache and click Save Changes:

 Enable (checked): Set expires header


 Enable (checked): Set cache control header
 Disable (unchecked): Set entity tag (eTag)
 Enable (checked): Set W3 Total Cache header
 Enable (checked): Enable HTTP (gzip) compression
 Disable (unchecked): Do not process 404 errors

zemalf.com | W3 Total Cache - Basic Configuration 27


Save changes.

BROWSER CACHE - CASCADING STYLE SHEETS &


JAVASCRIPT

(default = OK, no changes)

 Enable (checked): Set expires header


 Expires header lifetime: 31536000 seconds
 Enable (checked): Set cache control header
 Cache Control Policy: cache with validation
 Disable (unchecked): Set entity tag (eTag)
 Enable (checked): Set W3 Total Cache header
 Enable (checked): Enable HTTP (gzip) compression

BROWSER CACHE - HTML

(default = OK, no changes)

 Enable (checked): Set expires header


 Expires header lifetime: 3600 seconds
 Enable (checked): Set cache control header
 Cache Control Policy: cache with validation
 Disable (unchecked): Set entity tag (eTag)
 Enable (checked): Set W3 Total Cache header
 Enable (checked): Enable HTTP (gzip) compression

BROWSER CACHE - MEDIA & OTHER FILES

(default = OK, no changes)

 Enable (checked): Set expires header


 Expires header lifetime: 31536000 seconds
 Enable (checked): Set cache control header
 Cache Control Policy: cache with validation

28 W3 Total Cache - Basic Configuration | zemalf.com


 Disable (unchecked): Set entity tag (eTag)
 Enable (checked): Set W3 Total Cache header
 Enable (checked): Enable HTTP (gzip) compression

You can disable the W3 Total Cache headers if you want, but it‘s OK to go with
default.

Save changes (just in case, or if you disabled the W3TC headers).

You might change the Cache Control policies if you have issues with proxies,
but other than that, the above config is solid.

You don't have to, but if you now go and check your root .htacces-file, you'll
see that W3TC has added loads of rules there.

USER AGENT GROUPS SETTINGS

This is where you'll do tweaks for different agents, e.g. mobile users, but you
can skip these for now.

CONTENT DELIVERY NETWORK SETTINGS

This is where you'll configure W3 Total Cache to use your CDN or (sub-)domain
to server files in the Media Library, the Theme-files, minified-files, etc. W3
Total Cache does all this automatically.

PREVIEW MODE & DEPLOYING THE CHANGES

After you've done all the settings, go back to the General Settings -page and
hit 'Deploy'.

 You'll see 'Preview settings succesfully deployed'


 Hit 'Disable' to disable the preview mode and "go live"

zemalf.com | W3 Total Cache - Basic Configuration 29


 Hit 'Empty Page Cache'
 Hit 'Empty Minify Cache'

(as noted at the start, the 'Deselect this option to disable all caching
functionality.' option seems to be broken, just ignore it, even if its unchecked
by default)

30 W3 Total Cache - Basic Configuration | zemalf.com


If you want, check 'Combatibility Check' for some info. If you're on shared
hosting, these are pretty much out-of-your-control, but will give some clue in
case you have problems with W3 Total Cache.

It is normal that Opcode cache and Memcache extension are 'Not installed',
unless you have a Virtual Private Server or dedicated server and have'em
installed there.

But now you're done, you have succesfully installed and configured W3 Total
Cache on your blog.

zemalf.com | W3 Total Cache - Basic Configuration 31


W3 TOTAL CACHE - ADVANCED
CONFIGURATION

This configuration guide is for WordPress blogs on shared hosting, so this


guide does not cover the advanced configuration options available for
Dedicated / Virtual Private Servers.

With this guide, a blog can do well on cheaper hosting and withstand high
amounts of traffic without the need to go for more expensive hosting options
until you REALLY need them.

Thus, this guide does not cover the Database Cache or using the
Content Delivery Network.

I added information about CDN to my blog instead:

 CDN for WordPress with MaxCDN


 Setup WordPress CDN with W3 Total Cache and MaxCDN

To this guide, I‘ll include basic info about the database cache, CDN and special
configuration for mobile devices, but I won‘t go into too much details.

If you have questions and need help setting up the advanced options,
like special settings for mobile devices, Opcode cache and memcache,
or configuring your blog to use a Content Delivery Network - contact
me and tell me what you need, and I’ll help you out.

32 W3 Total Cache - Advanced Configuration | zemalf.com


DATABASE CACHE SETTINGS

If you have the Database Cache enabled (on the General Settings -page), you
can adjust the settings here. The default options work just fine, so no need to
actually change anything thou.

Note that on some hosts, using the Database Cache: Disk –option will speed
up the usage, and you can use Database Cache even on a shared hosting, but
in general, it‘s better to leave it disabled, unless you can use Opcode or
memcache options.

CDN SETTINGS

On the content delivery network (CDN) Settings, you can configure W3 Total
Cache to automatically move files into your CDN and deliver that content
instead of the content on your blog.

W3 Total Cache supports exporting the whole media library to CDN, so all
images you upload using the WordPress Media interface; they'll be
automatically handled by W3TC into your CDN.

For the best performance and speed, I recommend setting up a content


delivery network (CDN) and configure it into W3TC settings.

It's optional as it's not free, but it's well worth it in the end. Depending on your
hosting setup, it can even save you money as it takes the load and bandwidth
off your main server.

I personally use MaxCDN, and wrote a guide on how to set it up here:

 CDN for WordPress with MaxCDN

zemalf.com | W3 Total Cache - Advanced Configuration 33


REJECTED USER AGENTS AND MOBILE USER AGENTS

Usually (without plugin that delivers content based on the User Agent, e.g. ―a
mobile theme‖, see below for more info), there's no harm on delivering cached
content to everyone, including crawlers, so you might even empty the
‗Rejected User Agents‘ -list. If you‘re unsure what to do, don‘t touch the Pace
Caching - Advanced Settings at all.

MOBILE DEVICES, MOBILE THEMES AND - PLUGINS

You can skip the Advanced Settings on the Page Cache Settings, but if you
want to ensure your site works well for mobile agents (e.g. iPhone and other
smart phones), AND you use a special mobile theme via plugin like WPTouch,
you need to include the mobile agents in the 'Rejected User Agents' list. In this
case, the list needs to be copied on Minify Settings and CDN Settings as well.

W3 Total Cache also supports redirecting Mobile User Agents to a separate


URL, so if your site has a mobile version running in URL like m.example.com or
mobile.example.com, W3TC can redirect users there. Just make sure the
Mobile User Agents –list is up to date.

34 W3 Total Cache - Advanced Configuration | zemalf.com


AFTERWORD

Congratulations, you have now masterfully configured W3 Total Cache! Your


blog will be faster and the load on your (shared) server will be smaller.

WHAT NEXT?

You can now go and check how fast your blog is after installing and configuring
the W3 Total Cache –plugin. Use the same tools you used to analyze the
performance beforehand, like Pingdom Tools, YSlow and Page Speed
addons/extensions, etc. You can find the instructions here:
http://zemalf.com/1359/how-fast-is-your-blog/

Remember to log out when testing, since W3 Total Cache can work differently
for administrators (depending on your settings).

After you‘ve checked the results, I‘d love to hear your feedback on this guide…

zemalf.com | Afterword 35
YOUR FEEDBACK AND QUESTIONS

I want the stuff I create to be helpful. But I can‘t do it all on my own, I need
your help to make my content even better – I need you to tell me how I can
make this guide better.

If you have any questions, comments or feedback about this guide, send me a
message to using the contact form at http://zemalf.com/contact/

I‘d also love to know if there is anything you are struggling with when it comes
to WordPress, SEO and Internet marketing.

36 Your Feedback and Questions | zemalf.com


TROUBLESHOOTING

See W3 Total Cache FAQ from the plugin settings page for details if you run
into problems, and check out the official FAQ at WordPress.org plugin
directory:

http://wordpress.org/extend/plugins/w3-total-cache/faq/

If you run into any problems with the guide you can‘t figure out yourself, visit
my blog at http://zemalf.com/, send me a message using my contact form or
leave a blog comment on one of the WordPress optimization posts.

zemalf.com | Troubleshooting 37
WORDPRESS SPEED CHALLENGE

This W3 Total Cache installation and


configuration guide was created by Antti
Kokkonen, aka Zemalf. This guide was
originally created as a support material for
the WordPress Speed Challenge:

The WordPress Speed Challenge is a series of


posts & steps that help people to speed up
their WordPress blogs. All the materials are
freely available at Antti‘s blog - Zemalf.com

The challenge is about learning how to improve WordPress performance and


making a self-hosted WordPress blog load faster. The challenge is primarily for
bloggers with blogs on a shared hosting, even that the same optimization
techniques do work on all kinds of hosting.

In short, the WP Speed Challenge will help you optimize your WordPress blog
in a way that it will withstand huge amounts of traffic and load fast, even on
the cheapest hosting. This way, you don't need to upgrade to more expensive
options before you actually afford them.

If you‘re interested in making your WordPress blog faster, in order to retain


readers by keeping your page loading speeds at an excellent level and make
sure Google does not punish your blog for being too slow - start the challenge
at http://zemalf.com/1423/wordpress-speed-challenge/

38 WordPress Speed Challenge | zemalf.com


REFERENCES AND LINKS

Recommended readings about website performance and site speed

 Yahoo‘s Exceptional Performance guidelines:


http://developer.yahoo.com/performance/
 Google‘s Web Performance Best Practices:
http://code.google.com/speed/page-speed/docs/rules_intro.html

Websites to analyze page loading speed and performance

 Pingdom Tools: http://tools.pingdom.com/


 Page Test: http://www.webpagetest.org/
 Web Page Analyzer:
http://www.websiteoptimization.com/services/analyze/

Firefox addons for website performance analysis

 Firebug: http://getfirebug.com/
 YSlow: http://developer.yahoo.com/yslow/
 Page Speed: http://code.google.com/intl/fi-FI/speed/page-
speed/download.html

Services to analyze (advanced) things like HTTP headers and compression

 WhatsMyIP.org HTTP Compression Test:


http://www.whatsmyip.org/http_compression/
 Compression Check:
http://www.port80software.com/tools/compresscheck.asp
 Resource Expert Droid (REDbot): http://redbot.org/
 GZip Test: http://nontroppo.org/tools/gziptest/
 GIDZipTest: http://www.gidnetwork.com/tools/gzip-test.php

zemalf.com | References and Links 39


WANT ME TO HELP YOU?

If you don‘t feel comfortable doing this kind of technical tasks, want to save
your own time, or just want to make sure things are setup perfectly, you can
hire me to help you.

I‘ll both analyze your site and provide actionable report on what needs to be
done and you can do the optimization yourself, outsource it, or I can optimize
your WordPress blog for you, and make sure your site works well and loads
fast - guaranteed.

Whether you want just the W3 Total Cache installed and configured, more
comprehensive WordPress optimization package or other help with blogging,
WordPress or Internet business in general: Send me a message via contact
form at http://zemalf.com/contact/

40 Want Me to Help You? | zemalf.com


ABOUT THE AUTHOR

My name is Antti Kokkonen, but online I'm also


known as Zemalf. I'm a consultant, a software
developer, a blogger, a humble scholar of all things
online, and the Master Chief of Zemalf.com. I
specialize in WordPress, and optimizing websites,
whether it's for usability, speed, security or SEO.

I optimized my own WordPress blog for speed over several months, made
some posts about it and posted a video on my YouTube channel at
http://youtube.com/AnttiTV showing how fast my blog loads, even that I‘m
running the blog on a shared hosting (full page load in 1 second, beating
several ―high end‖ blogs with their fancy cloud hosting and CDN services).

That started a series of events and questions from fellow bloggers, after which
I decided to create several blog posts showing all the steps I took when
optimized my WordPress blog, and those posts turned in to the WordPress
Speed Challenge.

You can read more about me from my about –page at


http://zemalf.com/about/ and follow me 140 characters at a time via Twitter at
http://twitter.com/akokkonen

zemalf.com | About the Author 41


UPDATES

Jul 11th, 2010. Version 1.0: First version published on July 11th, 2010.

Version 1.01: Corrected typos and added quick notes to the ―How to uninstall
WP Super Cache‖ –chapter

Version 1.1: Re-worked the whole guide for the latest W3 Total Cache version.

Mar 28th, 2011. Version 1.2: Checked that everything is up-to-date and in
order. Minor changes to the advanced topics (CDN, Database Cache, Object
Cache).

42 Updates | zemalf.com
YOUR NOTES

zemalf.com | Your Notes 43


TABLE OF CONTENTS

Preface .................................................................................................. 2

Introduction to Site Speed ....................................................................... 3

How to Speed Up WordPress .................................................................... 4

About W3 Total Cache –plugin .................................................................. 6

Analyzing Blogs Performance .................................................................... 7

How to install W3 Total Cache................................................................... 8

How to Uninstall WP Super Cache ........................................................... 8

How to Install the W3 Total Cache ............................................................. 9

W3 Total Cache - Basic Configuration .......................................................11

General Settings ..................................................................................11

General Settings – General .................................................................11

General Settings - Page Cache ............................................................12

General Settings – Minify....................................................................13

General Settings - Database Cache ......................................................13

General Settings – Object Cache .........................................................14

General Settings - Content Delivery Network ........................................14

General Settings – Browser Cache .......................................................15

Page Cache Settings.............................................................................17

Page Cache Settings - General ............................................................17

Page Cache Settings - Advanced .........................................................18

44 <Table Of Contents | zemalf.com


Page Cache Settings - Cache Preload ...................................................18

Minify Settings ....................................................................................19

Minify Settings - Cascading Style Sheets ..............................................19

Minify Settings – Advanced .................................................................22

Minify Settings - JavaScript.................................................................22

Minify Settings – General....................................................................25

Minify Settings - HTML .......................................................................26

Advanced Minify Settings ....................................................................26

Database Cache and Object Cache –settings ...........................................27

Browser Cache ....................................................................................27

Browser Cache – General ...................................................................27

Browser Cache - Cascading Style Sheets & JavaScript ............................28

Browser Cache - HTML .......................................................................28

Browser Cache - Media & Other Files....................................................28

User Agent Groups Settings ..................................................................29

Content Delivery Network Settings .........................................................29

Preview Mode & Deploying the changes ..................................................29

W3 Total Cache - Advanced Configuration .................................................32

Database Cache Settings ......................................................................33

CDN Settings.......................................................................................33

Rejected User Agents and Mobile User Agents .........................................34

Mobile Devices, Mobile Themes and - Plugins ..........................................34

zemalf.com | <Table Of Contents 45


Afterword ..............................................................................................35

What Next? .........................................................................................35

Your Feedback and Questions ..................................................................36

Troubleshooting .....................................................................................37

WordPress Speed Challenge ....................................................................38

References and Links ..............................................................................39

Want Me to Help You?.............................................................................40

About the Author ...................................................................................41

Updates ................................................................................................42

Your Notes ............................................................................................43

Table Of Contents ..................................................................................44

###

46 <Table Of Contents | zemalf.com

You might also like