How to Install and Setup W3 Total Cache for Beginners

Posted on August 30th, 2010 by in WordPress Plugins | 177 Comments  
How to Install and Setup W3 Total Cache for Beginners

Last week, we wrote an article announcing that we have switched our site from WP Super Cache to W3 Total Cache. That article also announced our partnership with MaxCDN. Due to a very high volume of request, we have decided to create a step by step user’s guide to installing and setting up W3 Total Cache for beginners. In this article, we will show you how to install W3 Total Cache Plugin, set it up properly so you can maximize the benefits, and how you can combine W3 Total Cache with CDN services to make your site load even faster.

Before you begin, we want you to download the YSlow Addon for Firefox and run it for your site. Write down the load time of your homepage, and the letter grade YSlow gave your site.

What is W3 Total Cache?

W3 Total Cache is the fastest and most complete WordPress performance optimization plugin. Trusted by many popular sites including: mashable.com, smashingmagazine.com, yoast.com and WPBeginner. 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.

1. 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, where you will search the name “W3 Total Cache”. You should see results like the image below:

Installing W3 Total Cache

Install and activate the plugin. If you choose to do this via FTP, first download the plugin and then upload it in to your /wp-content/plugins/ directory. Upon the activation of this plugin, a new menu option will be added in your WordPress admin panel called “Performance”. Click on the tab, and you will enter the configuration area.

2. Settings and Configuration of W3 Total Cache

W3 Total Cache is a very powerful plugin, so it has tons of options. We will visit each of these options in detail, but first we need to start with the General Settings.

General Settings

Make sure that you are on the General Settings Page. You can confirm that by viewing two of these options:

Configure W3 Total Cache - General Settings

Now lets dive into the general configurations page. First you see an option to enable or disable preview. You should click disable, so the site is actually running W3 Total Cache rather than just previewing it. So your final screen would look like this:

Configure W3 Total Cache - General Settings

Next option on the screen will be Page Cache. This works just like how WP Super Cache plugin works. This section 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. For Shared servers, which most users are using, the Disk (Enhanced) Method is highly recommended. Your final screen result should look like this:

Configure W3 Total Cache - General Settings

After the page cache, you should see the option for Minify in the general page. Minify is the famous technique of reducing the size of your CSS files, JS files, HTML files, posts, pages, and RSS. What this does is remove the unnecessary objects that your users do not need to see. Such as commenting in the stylesheet. That is for developers, not for average users to see. This plugin will remove all useless spacing from the code which by average speeds up your site load time by 10%. Disk is the only / best option for Shared servers. Your final screen should look like this:

Configure W3 Total Cache - General Settings

Next option is Database Cache. This is crucial for site load time because WordPress sites are entirely running on Database. Often high load of database queries are the cause that slows yours site down and/or crash the site upon high traffic. The Database cache option will cache queries such as pulling the twitter count from your database, if you are using that. This option can essentially speed up your site by 100x. Your final setting for this area would look like this:

Configure W3 Total Cache - General Settings

Object Cache is the option that comes next. This increases the performance of highly dynamic sites that uses the Object Cache API. The final settings should look like this:

Configure W3 Total Cache - General Settings

The next option after this is for Content Delivery Networks (CDN). W3 Total Cache supports MaxCDN, NetDNA, Amazon S3, Rackspace Cloud, and Amazon Cloud Front. WPBeginner is using 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 CDN, then we recommend MaxCDN (use coupon “wpbeginner” for 25% off). Example screen of someone who uses MaxCDN would look like this:

Configure W3 Total Cache - General Settings

The next and last option on the general settings page is for Browser Cache. Browser Cache enables HTTP compression and adds expiration headers on the objects of your site. Each time a user visits your site, their browser stores a copy of your site, so on the next visit, your user does not have to re-load the site entirely (which speeds up the load time). But each browser resets the cache on their own schedule even when the file has not been changed. By enabling this, your site will tell the browser how long to hold each object. For example, you don’t change your favicon every day, or even month. That is something can be stored for one month period without change. The final screen should look like this:

Configure W3 Total Cache - General Settings

Now that we have gone through the general settings page, we will dive into each individual settings to give you a look for more options.

Page Cache Options in Detail

Now that you have enabled page cache, we will show you what other options that you can tweak. First you need to go to the Page Cache Settings page like so:

Configure W3 Total Cache - Page Cache Settings

Now you will see the following options:

Configure W3 Total Cache - Page Cache Settings

Notice in the screen above that you will see Page Cache is currently enabled. If you do not see this, then you are doing something wrong. Go back to general settings and enable it. Next, you also see a way to empty page cache. When you notice an error on your site, you want to immediately fix it. This could be a spelling error that your user reported, or something else. In a situation like that, you would have to manually clear the cache so the changes can be implemented on the live site right away.

We have selected the option to not cache pages for logged in users such as administrators. The reason for that is, if we want to see any changes that we make on the live site before it goes live, we can do so. Next option is cache the homepage. Homepage is often the most visited page on many sites. It would be a good idea to check that. Cache feeds, categories, and tags is checked because thousands of people go through our categories daily. Dynamically loading each page will slow our site down significantly. We have not selected the option to cache search strings, and 404 pages because we do not see a need for it, but for some websites it can be great.

Now we will look into some advanced options for Page Caching.

Configure W3 Total Cache - Page Cache Settings

Under the advanced options, you can see that we haven’t really touched the default. You can select to change the page cache to be longer or smaller interval. Default is 3600 seconds. You can make it smaller interval if you have a busy site. Next option is for Rejected User Agents and Rejected Cookies. You can select not to send cache pages to Google Bot, not recommend, but you can if you wish. If your page use a specific cookie, you should have those pages listed under rejected cookies page.

Under the never cache the following pages section, you see that we have added another page to the list. By default it is the index.php and wp-.php. But we added a manual page in there. The reason why we added this page was because we want this to load dynamically. This is a secret page on our site that you can constantly refresh to get a new tip randomly from our article database. See our Random Posts Page. You can add any page that you do not want to cache in that list. All the other settings can be left to default.

Minify Settings in Detail

Minify Settings advanced option will vary from site to site, but there are somethings that should be universal. First you need to make sure that it is enabled.

Configure W3 Total Cache - Minify Settings

As you can see in the image above, that you have a green text saying it is enabled. We recommend that you follow the settings above exactly as shown. Each option is self-explanatory. One thing you should note is the Help Wizard at the top. That is a very nice feature that will come in handy when we see the CSS / JS Minify settings.

We are not using JS minify for this plugin because it was causing some areas of our site to not work properly, but we have minified our CSS. You are required to attach files, which you can do by either entering the URL of the file, or using the helpwizard.

Configure W3 Total Cache - Minify Settings

Once you select the files in there, you will see them added in the minify page below:

Configure W3 Total Cache - Minify Settings

Everything else should be left to blank, unless you know what you are doing.

Database Cache Settings

We did not modify anything in the Database Cache settings. Everything was left as default. You do not need to modify it unless you know that your site needs additional modification. The most important section is the never cache the following pages. For example, if one of your page or section heavily relies on database queries, then it is wise to add that page or that entire section in this field:

Configure W3 Total Cache - Database Cache Settings

Object Cache Settings

Everything should be left as default for an average site. If you know that you need something in there specifically, then you may modify it.

Browser Cache Settings

By default, only Gzip compresssion and Set W3 Total Cache Header is enabled, but we have taken it a step further in our setup. We enabled Set Expires Header, Set Entity Tag (etag) for each option. You may do the same for your site as well. It is recommended that you do a little research about expire header and etag functions, so you make an informed decision that well-reflect your site. Not everything that works for us will work for your site as each site has different needs. There are tons of pros and cons of these functions which could be an article on its own.

CDN Settings in W3 Total Cache

This section will be slighly biased because we are only showing MaxCDN implementation. We are using MaxCDN and their quality service, so that is the only option that we have access to display (we will also explain why we chose them). If you followed this tutorial entirely, you should have already enabled the use of CDN and seleted MaxCDN as the option (only if you have an account with MaxCDN). If not, then this can be done through the General Settings. One you have done that, lets visit our CDN Settings Page.

Configure W3 Total Cache - CDN Settings

As you see that we have selected all four options in the general settings. Host wp-include files, this so if your theme is calling jQuery from WordPress include library, it will be added and served through the CDN service. Theme files option is checked, so all of our theme files are served via CDN. Host minified CSS and JS files via CDN. This is important to have checked, so when W3 Total Cache minify your CSS files, it can be served via a CDN. Lastly serve custom files via CDN. Often bloggers have a tendency of keeping somethings separate for the sake of organization. Let it be ad images, or other set of files. You can specify those to be served via CDN as well.

Setting up MaxCDN with W3 Total Cache for WordPress

Next option is configuration of your CDN provider. We will show you how to do that with MaxCDN. You need to have an “Origin Pull” CDN account. Rackspace Cloud, and Amazon cloud front, do not offer this service which makes MaxCDN superior. Origin-Pull is simple to use and highly transparent. This type is also known as “mirror” CDN.

1. Login to your MaxCDN account (If you don’t have one, then get one).

2. In your MaxCDN dashboard menu, click on “Manage Zones” option. Then click on “Create Pull Zone” button, just like it is shown in the image below:

Configure W3 Total Cache - MaxCDN Settings

3. On the next page, you will need to fill out the necessary information to create a Pull Zone:

  • Pull Zone Name: This can be anything without spaces, minimum 3 characters long. Think of this as your username.
  • Origin Server URL: Enter the URL of your wordpress blog. Must have “http://” and the trailing slash(/).
  • Custom CDN Domain: This is Optional, but we recommend it for the sake of branding. Use any subdomain for examplke: cdn.wpbeginner.com
  • Label: This is like a description field. It is optional to add a description.
  • Compression: We recommend that you enable this as it will save the usage of bandwidth on your account.

We have filled out the fields for you to see in the image below:

Configure W3 Total Cache - MaxCDN Settings

Upon creation, you will see a screen that will give you the URL for your CDN. If you chose the option for Custom CDN Domain, it will ask you to create a CNAME record for that domain. We will show you how to create the CNAME Record with cPanel Webhosting providers such as HostGator, Super Green Hosting, and Bluehost. You will need to login to your cPanel, then scroll down to the Domains Section and click on Simple DNS Zone Editor.

Configure W3 Total Cache - Adding a CNAME Record

Then you will fill out the fields to Add an CNAME Record. The two values, you will be required to fill are: Name and CNAME.

  • Name: This would be what you put in your MaxCDN Pull Zone as the Custom CDN Domain. In the image above, you see that our custom CDN domain is cdn.wpbeginner.com, so we will put “cdn” in our name field.
  • CNAME: This will be URL provided to you by MaxCDN when you create the Pull zone.

We have filled out the fields for you to see in the image below:

Configure W3 Total Cache - Adding a CNAME Record

Now, you have the CNAME created for your MaxCDN Pull zone. Note: This method will be different if you have a different host. Sometimes, CNAME records are created via Domain Registrar such as Godaddy.

Lets configure our W3 Total Cache Plugin to work with MaxCDN. In the general settings above, you have already enabled Content Delivery Network option and set it to Mirror: NetDNA/MaxCDN. So now when you go to the CDN Settings page, you will see an option for Configuration. W3 Total Cache wants you to enter the API ID, and the API Key. These can be found in your MaxCDN Dashboard if you go to Manage Account » API. Copy those and paste it here. Next complete the field that asks you to “Replace site’s hostname with:”. You will add your custom CNAME here. You can see in our example below, we have added cdn.wpbeginner.com.

Configure W3 Total Cache - W3 Total Cache CDN Configuration

After setting this up, your MaxCDN should be setup and ready to go. But there are other options that you can add as well to improve performance a little bit further. Lets look at the “Advanced” options on the Content Delivery Networks settings.

Configure W3 Total Cache - W3 Total Cache CDN Configuration

If you look at the image above, you see that some fields are already filled. The main part in this area is Custom file list. After enabling MaxCDN on our site, we saw that almost all files were being served via CDN except for some plugin files such as OIO Publisher, SyntaxHighlighter etc. So we decided to add those to the list. OIO Publisher is a plugin that lets us manage ads on our site (Full Review). When adding ads through this plugins, we can upload images through the plugin which were stored in the plugin’s uploads folder. So now all those images were served through CDN. Syntax Highlighter adds JavaScripts at the bottom of our page which were being served directly. So we added the syntax highlighter folder, so all files are served via CDN. This area will vary from site to site as each site uses different plugins. Some users will not have to add anything in here, but it is just an option to know. Also if you notice in the image above, there is a Rejected files area where contact form 7 file is listed. If you are using contact form 7, then you do not want to serve the captcha file through CDN.

This will conclude our CDN settings setup. 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/themes/wpbeginner/images/logo.jpg

will be replaced with:

http://cdn.wpbeginner.com/wp-content/themes/wpbeginner/images/logo.jpg

This concludes the setup of your W3 Total Cache Plugin. Your site should load a lot faster now. For the sake of testing, you can use YSlow to see what letter grade you get now compared to before. YSlow only recognizes the known CDNs names, so it will not recognize your custom subdomain. You will need to follow the tutorial on MaxCDN blog that shows how you can add your CDN to the list for your browser. This will be for the sake of testing the actual grade that your site gets.

Now that you have everything setup, it is best if you 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.

Configure W3 Total Cache - General Settings

This is good to do because if your site crashes, or you accidentally reset the settings, you will have a file to backup.

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 work 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 coupon “wpbeginner” for 25% off.

If you have any questions, then please feel free to ask in the comments below. Also don’t forget to share this article on Twitter, Digg, Facebook using the buttons to your left. We truly appreciate your support.

About

Editorial Staff at WPBeginner mainly Syed and David.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest

Nice tutorial, however, is there any solution to flush my cache every 12-24 hours. On one of my sites there is an "offer" that changes every day and since the pages are cached on different days, they show totally different offers - ones that are cached previously.

Does anybody know how could I do this? Is there any settings I haven't noticed? Or is there any plugin for that? Thanks

I have gone through the settings for placing the W3TC on site, everything seemed to go fine , however, I cave this msg:

"The setting change(s) made either invalidate the cached data or modify the behavior of the site. EMPTY THE PAGE CACHE now to provide a consistent user experience."

This is appearing on all pages in the back end of the admin.

doulble checked all settings - went by the book as above - 'do not have cdn'

Could someone pls explain what this may mean for the site...

and what I should do????

thanks.

just clicked the icon :o

msg gone now...

think I will have to do a little more research on this caching thing to get up to speed.

correct me if I am wrong...I have read somewhere about a few mths ago, not sure where, that if you have an established blog, but are still adding things like photos to posts and adding things like widgets or moving them around , it is not recommended to put in this W3 Total cache plugin otherwise it will duplicate content you are changing or updating??

Personally I didn't think that seemed right :/ probably someone could answer this, cheers.

waqaslone 5 pts

No It won't duplicate anything. May be what they wanted to say was if you keep making changes in yr site every now and then; they won't reflect right away. But if you choose not to minify when logged in, you can watch changes happening live.

it's better to make all design changes before using W3 Total cache. Likewise nothing wrong if you know how to make regular changes and not get effected. You might have to experiment a bit!

Thank you for clearing that up for me. waqaslone

Very easy to follow tutorial. Just registered with MaxCDN and applied to my site with w3tc plugins. Used your coupon also. Thanks a lot!

waqaslone 5 pts

wow I wanna use CDN too but still not enough traffic on my site :)

waqaslone 5 pts

Awesome dude...best tutorial ever!!!

kaidez 5 pts

dailyblogtools: yes. WP Total Cache provides CDN configuration as an option and not a requirement.

Sai@TechGenra 5 pts

very nice tutorial but i don't have CDN so is i can able to use wp total cache ?

waqaslone 5 pts

dailyblogtools 100% just don't touch CDN section. Most of the users don't have CDN. You only need it if you have some good traffic numbers.

Does "Minify" feature change my actual theme files? Would I have to backup my site before using "Minify" feature?

kaidez 5 pts

No, it won't change your files. It is a good idea to back them up regularly if you can.

Rocke 5 pts

I think this tutorial needs an update, there are some new features of W3 Total Cache uncovered here.

Jakob T 5 pts

I get this popup message on W3 Total Cache plugin page:

/home ... /wp-content is write-able. When finished installing the plugin, change the permissions back to the default: chmod .... /wp-content.

And on the installation page within the plugin, it says:

"1. Set the permissions of wp-content/ back to 755, e.g.:"

What does this mean?

wpbeginner 50 pts moderator

Jakob T Consider watching our tutorial in the Beginner's Guide category on how to use FTP. That will show you how to change the CHMOD permission.

mrintech 5 pts

I just setup "files.mrintech.com" Custom Sub-Domain in MAXCDN >> Created a CNAME record in cPanel >> Entered "files.mrintech.com" in W3 Total Cache

Everything is working fine, but when I enter http://files.mrintech.com/ - It opens Homepage content i.e. mrintech.com

I don't want this. Any solution? like redirection etc.

wpbeginner 50 pts moderator

mrintech The subdomain is for internal use only... so the page it opens should not matter because nobody should be accessing that name anyways...

mrintech 5 pts

Hi

Thanks for reply :)

What you are saying is absolutely correct. But will this create Page Rank Splitting Problem? as defined in this article: http://www.freshbooks.com/blog/2006/08/16/dont-spl... - As both MAIN Domain and Newly created Sub-Domain are showing the same Homepage content

Anyways, just wanted to know: When we create a Sub-Domain like thing using CNAME, is it possible to redirect it to Main Domain/Any other sub-directory using .htacess, PHP etc.?

Help appreciated from masters here :)

Thanks a lot and regards :)

wpbeginner 50 pts moderator

mrintech What is being mentioned in the freshbooks article is the famous www / non-www issue which splits pagerank... The reason why your pagerank gets split is when people link to a site, they sometimes write www and sometimes they just don't write www.... now if your site doesn't have proper 301 redirect setup for one or the other, then google believes that it is two separate pages. This causes them to assign separate pagerank which dilutes your page strength thus giving you a lower pagerank on both names rather than one high pagerank.However, in this situation no other site will be linking to your files.yourdomain.com link.... This subdomain is for internal use ONLY... So you would not have that issue.Hope this clarification helps.

PauldeWouters 6 pts

If you're using Gravity forms with the really simple captcha plugin instead of recaptcha, add this line to the excludes :

wp-content/uploads/gravity_forms/captcha/*

Jaxov 5 pts

I followed this guide and it works great thank you! ;-) I also wanted to change: "Minify Cache Method" to eAccelerator as i'm running on my own server i know that eAccelerator is installed but all these are disabled and the only think i can choose is "Disk" ?

Any idea how to enable it and if it will give me any more improvements?

liverpoolfootballblog 5 pts

Hi I followed the instructions carefully everything is working fine. However, I'm unable to log out of wordpress properly. For example, when I click log out I'm taken to the logged out page and it says I'm logged out, then, I click return to site and I'm still shown as being logged in the wp-admin bar. Help please!!

sibtiger33 5 pts

Nightmare unable to get cdn working with total cache. SQL errors every time I press the test DNA option. I've been using my cdn for years without issue before

vinaychhabra1977 5 pts

Very good article. I have tried it today and works great. I noticed that you are NOT using database caching and also not css minification.

Wonderful tutorial, i just set up an account with maxcdn and emplemented it following your tutorial!
thank you

I would like to warn everybody.

I am not saying that you will have those kind of problems but check it.

I installed 22 april W3TotalCache with CDN support.

Till then i have huge performace problems on my VPS server.

Today, almost 1 month later i solve them.

The reason for my problems was W3TotalCache, plugin produce high CPU and memory usage...

I replace that plugin with WPSuperCache with CDN support and finally everything is ok.

Tnx

Well what were your settings? It's completely possible to select incorrect settings and have poor performance because W3TC allows for so many possible configurations.

sibtiger33 5 pts

I think i'm gonna go back and test Total Cache today and see how it compares to Super Cache --... lets see how this goes

sibtiger33 5 pts

I also add problems with Total Cache when I tried it a few months ago so went back to Super Cache.

For those already on Super Cache and wish to switch please follow the instructions clearly on de-activating super cache its not always as simple as deleting the plugin ... there are other files (htaccess) which may need editing...

This is a great post.

Just one question though, if anyone knows: I'm using the Total Cache plugin with Cloudfront as the CDN.

So, when I'm minifying the javascript--should I list the original strings, like this:

http://www.fakepage.com/fake.js

Or should I minify the CDN version of that string:

http://www.cdn.fakepage.com/fake.js

If anyone knows, I'd be curious.

The first method. Because W3 Total Cache minifies your file, then it too is served via CDN.

Hi! I followed your tutorial step by step, but it keeps giving me this message : "Fancy permalinks are disabled. Please enable it first, then re-attempt to enabling the enhanced disk mode".

Can you please help me?

Hi guys

Ive had this plug in for quite a while now, but its just started causing my site to load REALLY SLOWLY so ive had to deactivate it for now which is a shame as i need to increase the speed of my site somewhat.I have only updated other plugins lately so i dont know why??

Do you have any idea what i can do to rectify this please?

thanks

Wonderful tutorial, I implemented this on my site without the CDN and I can say wow much better, thanks. I'd like to have permission to repost this on my Wordpress tweaks site located at tech2geek.com.

Hey Troy,

We don't allow direct replica of our tutorials. If you want, you can write an excerpt, and then link to the full article.

I've set up an account with MaxCDN and configured W3 Total Cache just like it said in the tutorial.
Now when I go to my site it appears as if none of the stylesheets are used. All of the markup seems to be gone.
Any thoughts on how to fix this would be greatly appreciated!

None of the images are displayed as well. Everything that is supposed to be loaded from MaxCDN isn't displayed.

Yes, that means that your simple zone editor DNS is not propagated. You might want to use the link they gave you for the time being.

Which link do you mean exactly? The example.example.netdna-cdn.com instead of using cdn.example.com?
I'm sorry, I'm just a total noob at this.

Everyone at the MaxCDN team would like to thank the team at wpbeginner for such a great article. We would also add our wiki link for some of the newer advanced features that have been added to the W3 Total Cache plugin at http://wiki.netdna.com/Implementation/Wordpress

Thank you very much for this tutorial! Just set mine up. I forgot all about the Simple DNS Zone Editor!

I'm using Total Cache, and TDO Mini Forms. I'm trying to exclude all forms from caching, but not having any luck. I used the exclude the following pages area, and tried entering the full url, as well as just /find-it (the name of the page the form is on) without any luck. I have it set up so that only registered users can access the form, but the problem is that if someone goes to access the form first, they're told to log in. Then when they log in, they're shown a cached version of the form, which of course tells them to log in again. Any help solving this would be greatly appreciated. Thanks!

Exclude the specific page that the form is on from being cached.

Useful article for every WordPress User, thank you very much :)

Hello, Great post. I followed the instructions but am unable to see my images. What am I doing wrong? Thanks for assistance.

Tweets about us: