Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Install and Setup W3 Total Cache for Beginners

Last updated on by
Follow WPBeginner on YouTube
How to Install and Setup W3 Total Cache for Beginners

We often get compliments from users on how fast our site loads. Everyone wants to know the secret behind a fast loading WordPress site. Aside from good web hosting and well-coded plugins, you have to make sure that you’re using proper caching and have a CDN (content delivery network). For our setup, we use a plugin called W3 Total Cache. Due to a high volume of request, we have decided to create a step by step guide on how to install and setup W3 Total Cache for beginners.

In this article, we will show you how to install W3 Total Cache and set it up properly to maximize the benefits. We will also show you how to combine W3 Total Cache wit ha CDN service to make your site load even faster.

Before you begin, we highly recommend that you check performance of your site by using Google Page Speed and Pingdom Tools. This will give you a before and after comparison.

Below is the screenshot of our Pingdom results:

WPBeginner Pingdom November 21st

Lets get started with our setup of W3 Total Cache.

Video Tutorial

If you don’t like the video or need more instructions, then continue reading.

What is W3 Total Cache?

W3 Total Cache is the fastest and most complete WordPress performance optimization plugin. Trusted by many popular sites including: AT&T, Mashable, Smashing Magazine, WPBeginner, and millions others. W3 Total Cache improves the user experience of your site by improving your server performance, caching every aspect of your site, reducing the download times and providing transparent content delivery network (CDN) integration.

Installing W3 Total Cache in WordPress

Before you install W3 Total Cache, you need to make sure that you uninstall all other caching plugins (for example WP Super Cache). If you do not do this prior to installing, the plugin will have issues upon activation.

We have a very thorough guide explaining how to install a WordPress plugin which you can follow. Or you can follow the brief guide below:

Go to your WordPress admin panel and click on Plugins » Add New. Search for “W3 Total Cache” and you should see results like the image below:

Installing W3 Total Cache plugin for WordPress

Click on the Install Now button and then activate the plugin.

Settings and Configuration of W3 Total Cache

W3 Total Cache is a very powerful plugin, so it has tons of options. This could be a good thing or a bad thing. For those who know how to use these options, they are a gold mine. For most beginners, these options could be quite tricky and confusing. We will visit each of these options in detail, so you can properly set up W3 Total Cache. Lets start with general settings.

General Settings

You can go to the General Settings page by clicking on the Performance menu button in your WordPress admin panel. This is where you will set up the plugin by configuring basic settings. Make sure that you’re on the general settings page and not the promotional Dashboard page that this plugin has.

W3 Total Cache General Settings Page

What is Page Cache?

The first option that you see on this page is Page Cache. It is responsible for creating static cache pages for each page that is loaded, so it is not being dynamically loaded upon each page load. By having this enabled, you will significantly decrease your load time. Refer to the image below to see how Page cache works:

What is Page Cache?

As you can see normally when a user comes to your site, WordPress runs PHP scripts and MySQL queries to the database to find the requested page. Then PHP parses the data and generates a page. This process takes server resources. Having the page caching turned on, allows you to skip all that server load and show a cached copy of the page when a user requests it.

For shared hosting which most beginners use, the Disk:Enhanced method is highly recommended. You should check the Enable Page Cache box, and save all settings.

Setting up Page Cache in W3 Total Cache for WordPress

For most folks, this is all you need to do with page caching. Since this guide is for beginner level users we will skip the advanced settings of page caching because the default options are sufficient enough.

We will also skip through Minify, Database Cache, and Object Cache. The simple reason is because not all servers provide optimized results with these settings. Next option you will see is Browser Cache.

What is Browser Cache?

Every time a user visits a website, their web browser downloads all the images, CSS files, JavaScripts, and other static files in a temporary folder to enhance the user experience. This way when the same user goes to the next page, it will load much faster because all the static files are in their browser cache.

Browser Cache option in W3 Total Cache sets a time limit on the Browser Cache. Considering you don’t change your logo every day, having static files like that cached for 24 hours does not hurt you. Simply check the Enable under Browser Cache option and click Save all settings button. Once you have done that, then lets visit the Performance » Browser Cache page for more settings.

Setting up Browser Cache options in W3 Total Cache

As you can see in the image above, we pretty much enabled everything except for the 404. When you save the settings, all settings below on that page will automatically take care of itself.

In our free WordPress setups, these are the default settings that we turn on.

What is a CDN?

CDN stands for Content Delivery Network which allows you to serve your static content from multiple cloud servers rather than just one hosting server. This enables you to reduce server load and speed up your website.

We have created an infographic on What is a CDN and Why you Need a CDN for your WordPress site. We highly recommend that you check it out, so you can make an educated decision.

W3 Total Cache supports MaxCDN, Amazon S3, Rackspace Cloud, and Amazon Cloud Front. WPBeginner is using MaxCDN (why we use MaxCDN). This section will only apply to sites that are using CDN, or are planning on using CDN. If you think you will be using a CDN, then we recommend MaxCDN (use coupon “wpbeginner” for 25% off).

First thing you need to do to is create a Pull Zone in your MaxCDN dashboard. Log in to your MaxCDN account, click on Manage Zones and then click on Create Pull Zone button.

Configure W3 Total Cache - MaxCDN Settings

On the next screen you will be asked to provide details for your pull zone.

  • Pull Zone Name: Simply give any name to this pull zone so that you can identify it in your MaxCDN panel.
  • Origin Server URL: Enter your WordPress website’s URL starting with http:// and ending with a trailing slash / at the end.
  • Custom CDN Domain: enter any subdomain, for example: cdn.wpbeginner.com
  • Label: Provide description for this pull zone.
  • Compression: Enabling compression will save you bandwidth so it is highly recommended that you check this box.

A screenshot of how the above mentioned settings will look like:

MaxCDN Pull Zone Details

Click on the Create button and MaxCDN will create the Pull Zone. On the next screen, it will show you a URL like this one “wpb.wpbeginner.netdna-cdn.com” copy and save this URL in a text file using notepad because we will need this later.

Now that we have created a Pull Zone, the next step is to set up content zones. You can do this by going to your MaxCDN dashboard. Click on the manage button next to your pull zone that you just created. On the next screen, click on the Settings tab. The purpose of creating content zones is to add subdomains, so that we can improve user experience by queuing content from different subdomains into user’s browser. To do this click on the button labeled Custom Domains and add multiple subdomains. See the screenshot below:

MaxCDN Multiple Subdomains

Once you have added custom domains simply click on the Update button.

The next step is to set up CNAME records for the subdomains. Most of our recommended WordPress Hosting providers such as Hostgator, Bluehost, etc provide a cPanel to their clients to manage different settings of their hosting. We will describe how to set up a CNAME record in cPanel.

Log in to your cPanel dashboard and then click on Simple DNS Zone Editor under Domains.

Configure W3 Total Cache - Adding a CNAME Record

On the next screen you will see a form with two fields. Enter the subdomain name you entered while creating the content zone. For example you will put cdn for cdn.wpbeginnner.com.

cPanel will automatically fill in the full domain. In the CNAME field enter the URL provided by MaxCDN when you created the pull zone. It is the URL we asked you to save in notepad.

Configure W3 Total Cache - Adding a CNAME Record

Repeat the process for all your subdomains, e.g. cdn1, cdn2, etc. Remember that only the name field will change each time and the CNAME field always have the url provided by MaxCDN for your pull zone. Once you have created CNAME records for all subdomains, it is time to go back to WordPress and setup MaxCDN with W3 Total Cache.

Go to Performance » General Settings. Scroll down till you find CDN configuration box. Check Enable and select MaxCDN from CDN Type drop down menu. Click on Save All Settings button.

Enabling MaxCDN in W3 Total Cache

After saving settings you will see a notification informing you to provide information for “Authorization Key” and “Replace default hostname with” fields and select a pull zone. Click on “Specify it here” link and W3 Total Cache will take you to the CDN page.

W3 Total Cache specify settings for MaxCDN

On the next screen click on the Authorize button. This will take you to MaxCDN website where you will generate an authorization key. Copy and paste this key back in W3 Total Cache. In “Replace site’s host name with” enter the subdomain you created earlier.

Entering MaxCDN API key and setting up hostname in W3 Total Cache

Save all settings and that’s all. Your site is now configured to serve static files using MaxCDN. Now if you load your site, the image URLs should be served from the CDN subdomain rather than your site’s actual domain. For example:

http://www.wpbeginner.com/wp-content/uploads/2010/08/w3totalcachecdnconfig.gif

would be replaced with:

http://cdn.wpbeginner.com/wp-content/uploads/2010/08/w3totalcachecdnconfig.gif

Now if any of your static files are not loading with the CDN, then it probably means that you will need to specify it in the custom files list setting in W3 Total Cache. We had to do it for OIO Publisher plugin that we use for serving ads. If you go to the CDN settings page, you will see the Advanced option:

Advance CDN settings in W3 Total Cache

Simply add all the files/folders that you want to include for CDN. Also if you notice, there is a rejected file list. When you make a small design update, your style.css will not update right away. So you can put that in a rejected file list for the time that you are making changes. If you just want a one-time purge, you can do that from your MaxCDN dashboard.

Everything that we have covered up till now, will work great on most web hosting accounts. However, W3 Total Cache comes with many other options. We will try our best to explain what they are, and why we do not enable them on all sites.

Minify

Minify simply reduce the size of your static files to save you every single kilobyte that you can. However, sometimes generating that minified file can be more resource intensive then the resource it will save. We are not saying that it is a horrible function. We are simply saying that it might not be the best fit for every server. We have heard numerous users complaining about it, and our host (HostGator) recommended us to leave this off. If you are like us (NOT SAVVY with server lingo), then listen to your web hosting provider.

Database Caching

Database caching reduces the server load by caching SQL queries. This eliminates the processing time of querying the database (which may not be a lot for smaller sites). When we started using this, it seemed to put a lot of load on our server. Our host recommended us to turn it off. Instead, they ended up turning on the built-in SQL caching for us. Again, use this option at your own risk. You can try it out and see how it impacts your site load time. Then simply turn it off, if the impact is not significant enough. Most hosts do not recommend this for shared hosting accounts.

Object Caching

If you have a highly dynamic site, then using the Object Caching will help. This is mainly used if you have complex database queries that are expensive to regenerate. For most beginners, ignore it.

Now that you have everything setup, it is best to create a backup for your W3 Total Cache Configuration. After all, we went through a lot in this article. You will need to come back to your W3 Total Cache’s General Settings Page. There is a section for Import / Export Settings. Click to Download the settings file from your server.

We hope that you found this article useful. For those users who are still not sold on the concept of CDN, we highly recommend you give it a shot. CDN works with your web host to decrease server load and increase site performance. We are using MaxCDN and we recommend you to do the same. (Try them for just a month, and you will see why we recommend them). Use the MaxCDN coupon “wpbeginner” for 25% off.

If you have any questions, then please feel free to ask in the comments below.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • http://www.wpbeginner.com/ WPBeginner Staff

    You can add your shopping cart page as an exception in w3 total cache. Under Performance > Page Cache scroll down to advanced section where you will find the option ‘Never cache the following pages’. For example, if your eCommerce plugin uses a page cart for checkout, then simply enter “cart/” to exclude that page or “cart/*” to exclude that page and all sub-pages. (Without the quotes, of course.)

  • http://www.wpbeginner.com/ WPBeginner Staff

    We haven’t noticed any significant conflicts on any of our websites where we use it. Even then, if you come across a conflict then notify the plugin author by using the support tab on the plugin’s page.

  • http://www.wpbeginner.com/ WPBeginner Staff

    Take a look at this URL:

    http://site1.example.com

    In this URL site1 is a subdomain of example.com

  • http://www.chadrogezdesign.com/ Chad Rogez

    That was just what I needed. Made the setup much easier and the details allowed me to understand what the purpose of each function was. Thanks for the details!

  • md

    This was extremely helpful. W3TC has some of the most non-intuitive settings I have ever seen.

  • http://iartisan.com Craig

    Very helpful post! Been using W3TC for quite awhile, but configuring a CDN can be a little tricky. This guide made it a breeze. Thank you! :)

  • Fauzul

    Luckily found this short tutorial, my blog page load increased severely after setting up the caches. Now I know better what to turn on and what cache to leave disabled. On shared hosting, in my opinion it’s only good to turn on page cache and browser cache.

    Now going to try it with a CDN. Hopefully things can improve further.

  • Susan

    Hi,

    I using a wp multi site install and Cloudflare but I just cannot find any instructions on how to configure W3.

    When activated network wide there is nowhere to add individual distributions for each sub domain.

    Or else I’m missing something!

    Any help is much appreciated

    cheers

    • http://www.wpbeginner.com/ WPBeginner Support

      You will find CloudFlare available as an extension under Performance » Extensions. After activating CloudFlare extension you will be able to see its settings.

      • Ejaz Khan

        Thanks!

  • Sharon

    Awesome article! Just what I was looking for – my site is on Hostgator and I’d love to use both W3 Total Cache and Max CDN. Perfect.

    BUT I got lost at the point of creating subdomains. I just don’t understand what that means or how to create one. Just make one up? Find one somewhere on my site. Very confused.

    My site is slow – it gets a C at best on GTMetrixs, and I’m preparing to do a big campaign. I need help.

    Do ya’ll offer support services? I saw that you do free blog set ups. Would accept payment to help set these up for me?

    Sharon

  • Mike Hirst

    Thanks so much for this article. My site is blazing fast now!

  • Zubair

    Hi ! its a nice plugin . but i installed WP Fastest cache instead , so now i am facing a little problem with this . i have used contact form 7 with really simple captcha but after installing the WP Fastest Cache the captcha image is broken in the website. so how to get rid of this or if i install w3tc will i overcome this problem.

    Regards

    Zubair

  • Philip Verghese Ariel

    Hi Admin & Syed Balkhi.
    What a pleasant land here.
    I am really in search of such a page
    since I am new to this platform called WP :-)
    Recently i created (migrated) my blogger page here with the help of one of my blogger friends. Now I am here via Arun’s page here at WP, and found this place is a good place for a WP beginner like me :-) I think this looks like a bit advanced page to me, so i am going
    to your Archives WPBEGINNER ARCHIVES” to find some basic lessons :-)
    Anyways I will be here to look and study around :-)
    Thanks a lot for all your efforts to put these lessons in a systematic way.
    I am bookmarking this page.
    Have a wonderful time.
    Best Regards
    Philip

  • Alex

    thanks guys for your awesome job.

    In the dashboard W3 gives a tip to upgrade to Pro for $99. However all the functions you described can be checked without upgrade.

    Then what this upgrade is for? – should i go ahead and purchase the upgrade?

  • Carla

    I’ve been trying to set up this plugin for ages. I just left the default settings and it was very helpful. Now that I have additional settings checked, my site is super speedy. Thanks so much! I did not set the CDN though because I have ClourFlare enbaled.

  • David Geer

    I am at the step where I configure the CDN section in W3TC. I added cdn.davidgeer.com and clicked add cname. It added it and said it was reserved for CSS. Then another field popped up to add another CNAME and it said it is reserved for js in . Should I keep adding each of my consecutive cnames to the available cname fields that pop up here in W3TC and then save settings?

    • http://www.wpbeginner.com/ WPBeginner Support

      You need to add CNAMEs you created with MAX CDN.

      • Adam Lindsey

        I seem to be having an issue as well. There is the long CNAME url.url.netdna.cdn.com that works, but if I use the cdn.tnmedia.com, cdn1.tnmedia.com, etc. It doesn’t work. Isn’t it better to have JS files pulling form one subdomain and have another pulled form a different one or am I way off base here?

  • Joe DeCaro

    I love your site. I installed W3TC and set it up as you suggested. I’m on shared hosting. Now that it is installed, I’m getting emails from readers saying they can’t see our latest posts as they go up.

    Did I do something wrong?

    I set the browser cache settings step by step as you advised.

    What may have cause this new issue for my readers since installing the W3?

    Thanks.

    My site is MetsmerizedOnline.com

  • Osnilton Mozarino

    Thanks for the great article!!! As usual very well written and informative.
    Question: I now have a pretty clear idea about CDN, however for a regional or national only web site, will it still be benefitial to use it, as the hosting server(s) are already in the main cities, say close enough? As it seems to be a great thing for international web sites.
    Thank you

    • http://www.wpbeginner.com/ WPBeginner Support

      Yes if u live in a big country like US. If you are in a small country then no.

  • Himanshu Goel

    Hey I have tried installing and managing with this plugin and I don’t own a cdn. do this plugin works with cdn better or we can try some extra efforts in settings to make this work better without cdn.

    Should we actually use caching plugin if we are not running up with cdn services (I am involving every cache plugin)

    • http://www.wpbeginner.com/ WPBeginner Support

      W3 Total Caches works without CDN and is still very useful. However, using a CDN service will further boost your page load time.

  • Zalmey

    My Question is that, will I get better performance from W3TC without MaxCDN & CloudFlare. Does anyone using it with these 2 and having a good load time?

  • Andy Crichton

    Great article. I know just about enough to get myself in trouble, so I did ask the MaxCDN guys a lot of questions before and during setup. I asked a couple of times about the subdomains, I said it sounds cool and logical to have the 4 extra to serve certain files “instantly” – they said the difference in delivery is almost non existent, like 10ms. So I havent bothered. Have you really seen a significant difference with / without the 4 subdomains at work?

    thanks

    PS I didnt know about your affiiation before I signed up to MaxCDN, but anyone reading, wow, the company is brilliant! There was an issue with my forum plugin – when the CDN was installed, the theme broke if you did a quote, and also members couldnt login. MaxCDN analysed it and I gave them admin access and they sorted it. Also the delivery of the site (hosted in Colorado) now in Europe is down from 4 secs to 1.5 according to pingdom.

    • http://www.wpbeginner.com/ WPBeginner Support

      Andy, its up to you, we would say that every millisecond counts.

  • Sherif

    Hi,

    Thanks for your time writing this, it is very helpful and i setup W3TC but after that i started getting a strange error about database connection lost every time i try to post new post or edit and existing one,any clue what should i do or where to start looking around

    If i disabled the plugin, this error message is not showing any more and i am able to post normally

    Sherif

  • Donna Caissie

    I installed Total Cache several weeks ago, and since then, using my backend has been a nightmare. Every time I tried to do anything in the backend, my browser (Firefox) would hang. I finally deactivated Total Cache today, and now my backend works just ducky.

  • Hayslan

    Hey guys, what do you think of leaving somewhere in the post – maybe at the end, a ‘log’ of what section / topic went updated?

    A long time ago I read this article and now for example I have no idea at what point it went updated.

    Would not it be helpful? Let me know!

  • Cynic

    Great article. Thanks for sharing.

  • Savvas

    Does it work ok with wp multisite??

    • http://www.wpbeginner.com/ WPBeginner Support

      w3 total cache supports multisite

  • Steve

    I’ve tried several times to install caching plugins (both W3 Total Cache and WP Super Cache) and in every case, my overall site performance takes a major hit as soon as the plugin is activated/configured.

    This time, I followed the instructions to the letter as shown above. However (as has occurred in every other time I’ve tried), load time throughout the site has at least tripled.

    The one thing I didn’t do in every case is get a CDN, due to the cost involved.

    So my question is this.. do the caching plugins only work in conjunction with a CDN?

    If so, is there any other way to speed up performance (aside from the obvious – removing plugins, etc). I use WP Optimize regularly.

    • http://www.wpbeginner.com/ WPBeginner Support

      There could be some server configuration problem on your host’s end.

      • Steve

        Could you give me more details on what to ask about? My hosting service service is usually good about that sort of thing, but I’d need to know specifically what to ask about.

        • Andrew

          Turn off database caching if you are on shared hosting, it will bring your speed back up.

  • Abhisek

    I am planning to go for maxCDN but, i have a dilemma that, i use a sub-domain to store all my media files something like this – media.example.com. As a result Wp-Smush it plugin no more works and i have to compress images myself using png-gauntlet software in windows. Will this sub-domain also create any problem in switching to maxCDN ?

  • Manasseh Copinger

    Great post really like every single post from you.

  • Shahraar Khan

    Very nice tutorial . But I personally like wp Super cache

  • Jeremy Myers

    First, where is your “after” screen shot from Pingdom? That “before” test was pretty dang good, and I am curious to see if it actually improved.

    Second, I have done a lot of testing between W3 Total Cache and WP Super Cache. I agree with W3 has more options and seems to be a better plugin, but with W3, my server response time nearly tripled! It went from about .25 seconds to almost a full second. Why is this?

    Third, what about Cloudflare integration? Any suggestions one way or the other?

    • Denise Blackman

      Hi Jeremy. I don’t have the answer to the increased response time of your server with W3, but I had the same problem. Mine, however, was even more severe, with an increase to almost 1.25 sec. I wish someone could answer this. My host provider has no answer either. My personal guess is that the server that is hosting my account, which is a shared server, is over taxed. It is normally what happens when an account suddenly has major performance issues.

      In reference to CloudFlare, I have tried to integrate it, but had problems with my theme. I had to disable it. It made way too many changes to my CSS. I don’t know a lot about CloudFlare, and it sounded great. I just couldn’t figure out a way to make it work with my theme at all.

  • Dmitriy

    Great article, very detailed!
    If someone has any questions regarding MaxCDN feel free to ask me.

    Thank you

    • Alex

      Dmitry,

      Due to localized business activity my website is set for a specific location, Moscow Russia. That said I don’t expect people from other cities to bother me. Do you think I still should go for the MaxCDN?

      Thanks

  • Raghu

    One more step for MaxCDN : Add noindex to cdn contents to prevent Google from indexing CDN contents which will create duplicate content issues.

    It’s under Zones > Pull zones > SEO

    Check enable and use custom robots (with default code for robots.txt)

    • Alex

      Raghu,

      thanks for the heads-up. Do you mean I need to edit robots.txt or there are just default options that I need to check in Zones > Pull zones > SEO section?

      The necessity to touch robots.txt kind of scares me as I am not a coder.

      thanks