Important Note

This tutorial assumes you have already created a pull zone.

Installing W3 Total Cache

  1. Log into your WordPress Admin Panel.

  2. On the left-hand sidebar, hover your mouse over “plugins” and click “add new.”

  3. In the search box, type “W3 Total Cache.” Then hit the search button.

  4. You’ll see the W3 Total Cache plugin listed under the “name” column. The description will list the creator as Frederick Townes. This is the plugin that you’ll want to install.

  5. Install the plugin.

  6. A message will pop up asking you if you’re sure you want to install the plugin. Click “OK.”

  7. Once the plugin has been installed, you’ll need to activate it. Just click the “activate plugin” link to do so.

  8. A new menu item called “performance” will appear at the bottom of the left-hand sidebar. Hover over it and select “general settings.”

Configuring W3 Total Cache

  1. Log into your WordPress Admin Panel. Scroll down to the “performance” link on the left-hand sidebar and select “general settings.”
  2. Scroll down to the page cache box. Check the box to enable page caching and then make sure that “Disk: Enhanced” is the selected method.
  3. In the next box down, enable the minify function by checking the box and selecting the “manual” mode.
  4. Database cache should be disabled, so make sure that the “enable” box is not selected.
  5. Check the boxes to enable object and browser caching.
  6. Enable CDN, and then select MaxCDN from the drop-down list.
  7. On the left-hand sidebar, look under “performance” and click on “CDN.” Now you can enter detailed CDN settings.
  8. In the “general” section, you can select which filetypes to host on CDN. To get SEO benefits, check the box for “add canonical header.”
  9. Scroll down to “configuration” section. In the “authorization key” field, you need to input your API details, which consist of your alias, consumer key, and consumer secret.
  10. It will need to be in this format: “alias+consumer_key+consumer_secret.”
    To make things easy, just click the “authorize” button. It will take you to your CDN control panel and retrieve your API details for you.
  11. If you don’t yet have API generated, please follow this instruction page.
  12. Once you’ve entered your authorization key, you can enter your CDN domain into the “replace site’s hostname with” field.
  13. Your CDN domain was created when you made a pull zone. To find it, go to your MaxCDN control panel and click on “manage” for the pull zone you’re working with. Your “CDN URL” will be listed – copy and paste that into the hostname field back in WordPress, and you’re good to go.
  14. Hit the “test MaxCDN” button to make sure everything is in order.
  15. You might be directed to the W3TC plugin page with this error: “A configuration issue prevents CDN from working: You need to select / create a pull zone. Specify it here.” If this happens, just click the provided link called “specify it here” and you’ll be directed back to the “configuration” section in WordPress to select a pull zone from newly provided drop down list.
  16. Once you’ve done that, try clicking on “test MaxCDN” again. It should work this time.
  17. To finish up, click “save all settings.”
  18. Tweaking

    1. To tweak your browser cache, click on “browser cache” under the performance menu heading on the left-hand sidebar.
    2. Under “General” section you have the provided features for browser caching:

      • Set Last-Modified header
      • Set expires header
      • Set cache control header
      • Set entity tag (eTag)
      • Set W3 Total Cache header
      • Enable HTTP (gzip) compression
      • Disable cookies for static files
      • Do not process 404 errors for static objects with WordPress
      • Hit “Save all settings” to finish defining browser cache policy.
    3. If you want to tweak minify, click on “minify” under the performance header on the left-hand sidebar.
    4. At the top of the page, click on the link for “HTML & XML.”
    5. You’ll see the “HTML & XML” section, where you can check the box to enable HTML minify settings.

    6. Now, you’ll be able to choose the settings that you want:

      • Inline CSS minification
      • Inline JS minification
      • Don’t minify feeds
      • Hit “Save all settings” to finish setting minify.
  19. Additional CDN Tweaks

    1. Custom File List (Performance → CDN)
      W3TC may not automatically identify all of the files that you want served by the CDN. To change this, simply add these files or directories to the “Custom File List” text area (one file/directory per line).
      Some files that are commonly ignored are those within your wp-content/uploads directory. To serve these files add this line to the text area: “wp-content/uploads/*” or use directives to locate WP directories (wp-content, uploads, plugins, gallery) as follows:

      • {wp_content_dir}/gallery/*
      • {wp_content_dir}/uploads/avatars/*
      • {plugins_dir}/wordpress-seo/css/xml-sitemap.xsl
      • {plugins_dir}/wp-minify/min*
      • {plugins_dir}.css
      • {plugins_dir}/*./*.js
      • {plugins_dir}/*gif
      • {plugins_dir}/*.jpg
      • {plugins_dir}/*.png
    2. Rejected File List
      There may be certain files that are being served by the CDN that you would like to serve locally. Usually, these files are parts of plugins designed to disregard cross domain load. To change this, simply add these files or directories into the “rejected files” text area (one file/directory per line) and jus as with the “Custom File List” you can use directives to locate WP directories:

      • {uploads_dir}/wpcf7_captcha/*
      • {uploads_dir}/imagerotator.swf
      • {plugins_dir}/wp-fb-autoconnect/facebook-platform/channel.html

NOTE

To ensure you implemented MaxCDN correctly, you can view the source code of any page to confirm that the CDN domain is being used for static assets instead of your origin domain. You can also use tools like pingdom, gtmetrix, webpagetest that can give you more detailed reports on your CDN implementation status.

Side Notes

  • In some cases, enabling minify for CSS/JS or database caching will result in errors or a broken website. It might be a good idea to disable these two options for the time being.
  • In some cases, Flash-based sliders/carousels break when using W3 Total Cache. If you notice such issues, make sure to add the slider plugin path to the W3 Total Cache “rejected files” box.
  • When using W3TC, your origin URL for the pull zone must always be the main root domain like http://domain.com, even if the website is actually installed in a subfolder like http://domain.com/wordpress/. This is because W3TC will automatically add /wordpress/ at the end of the CDN domain. So if the origin URL contains /wordpress/, then the final W3TC CDN URL would be http://domain.com/wordpress/wordpress/.
  • Using the test button won’t execute a CDN implementation/functionality test, it is only used to test the API connection with MaxCDN. The API is needed for the W3TC Dashboard widget and for remote purges of CDN files.

Find more CDN/caching plugins for WordPress on this page.

  • Aaron Cooper

    Thanks for the tutorial! I’d be completely lost without it!

  • Mahmoud Kamal

    This is one the best thing that we have ever done for our websits http://prokr.com and our directory http://prokr.com/blog
    Great services and great support team

    Cheers

  • http://minivapeshop.com/ MiniVapeShop.com

    Why is it when I enable “Host Attachments” “Host wp-includes/files” “Host theme files” or “Host custom files” my page breaks down even if just one is checked. What step did I miss or didn’t do?

    • Ivan Dabic

      Hi there,

      Would you mind contacting us via phone or live chat so we can debug this in real time with you? There are potentially variety few possibilities and I’d like to have you online while checking this.

      • http://minivapeshop.com/ MiniVapeShop.com

        It’s solved… enabling Shared SSL worked! Thank you guys for the quick response and help.

  • Andr jumpta

    Will CDN boost my wordpress site SEO?

    • Ivan Dabic

      Hey Andr,
      Since “recently” you have SE rate you by performance (grade) as well and with that in mind, it’s safe to say that your SEO can be optimized by adding CDN but it’s not it’s primary function.
      Shortening the distance between your heavy objects and your end users is what CDN does (in general) but, with this functionality your SEO can be improved as well.

  • http://www.kursatkarabulut.com/ Kürşat Karabulut

    I’m receiving “Could not create default zone.Invalid signature” when I click on “Create Default Zone”. So I manually set up a pull zone. But now my “Test MaxCDN” button lasts forever. What am I missing? I did everything the same as on this page.

    • Ivan Dabic

      Hi Kursat,
      I am sorry for late reply here, hopefully, you got your issue sorted out. If not, you should be aware that TEST button only tests the API connection with MaxCDN and not he actual CDN functionality. To use API you need the API key implemented as described in steps #8 and #9 OR, you can do it manually by following this article:

      https://www.maxcdn.com/one/tutorial/create-api-idkey-pair/

      Again, keep in mind that API is needed only to support remote purge (from within WP admin area) and for Reporting within W3TC dashboard.
      Meaning, you probably have CDN implemented but API validation is failing because of above reasons. Could you, come to our live chat so our support team can verify your setup? In case you are still having this problem, that is.

  • http://www.thefas-solutions.com/ Daniel Keith

    Hi
    there,

    Nice post. I thought that W3 total cache would be the best solutions to
    decrease my website’s load time. But everything went opposite.

    Before installing it my website’s load time was 7.59s which has now reached
    to 8.31s. Any idea what happened wrong?

    • Ivan Dabic

      Hi Daniel,
      Sorry for late reply. There are numerous of possible reasons for this, from CDN misconfiguration to plugin conflicts with server platform and other plugins. Would you, mind getting on a chat with our support to sort this out? That is, if you are still facing this issue 🙂

      • http://www.thefas-solutions.com/ Daniel Keith

        Thanks Ivan for your reply. I simply removed the W3 total cache from my website. Now every thing is fine.

  • http://AlainHernandez.net/ Alain Hernandez

    I was able to follow this wonderful guide step at a time and successfully configured my maxcdn

  • http://cn.derekyang.us Derek Yang

    Hey! How do I verify that my CDN is working on wordpress?

    I followed this guide and configured my new wordpress site, but not sure if Ineed to do anything else.

    For example, when I used CDN on my static blog, I know I have to use the “cdn” image link. Do I need to do the same –tweak the image URL– when I add post to wordpress site? Or do I just upload photos as normal, and W3 Total Cache would take care of it, in terms of CDN delivery?

    • Ivan Dabic

      Hey Derek,

      Thanks for writing in on this matter. If article is followed properly you should be fine with MaxCDN implementation, however, to be sure that it’s all good you can open the source code of any page on your website and checkout the inner links to static assets. You should see your static files coming from CDN domain instead your origin/website domain.

      Also, some tools like pingdon, gtmetrix and webpagetest can give you the list of all the files on your site and the location these are being pulled form.
      For detailed debug and check up, please write us on support@maxcdn.com so we can do the necessary tests for you and compose the report as well.

  • http://zephyrstudio.com Mike Oliver

    Hello, can you clarify which settings need to be changed for VPS and Dedicated hosting? Apparently the page cache method changes, and database caching should be turned on? Thanks

    • http://www.maxcdn.com/ Petar Petrovic

      Hello Mike,

      Page and database caches are server side caches, which means that they have nothing to do with the CDN cache. I suggest that you keep the defaults and ensure that the CDN cache is enabled, since default settings are known to work best in the majority of cases. If the issue persists after switching to default settings, please feel free to send us more details to support@maxcdn.com so that we can take another look at what might be causing the issue.

      • http://zephyrstudio.com Mike Oliver

        Thank you Petar, I will clarify it with my host and maybe do some testing.

  • agustin

    Hello, while trying to setup w3tc i got thes erros “Your IP 173.201.196.55 is not whitelisted ” AND ALSO “Error: No zones match site: http://healthcaremarketinggroup.com.” Can anybody help me please. Thanks!

    • http://www.maxcdn.com/ Petar Petrovic

      Hello Agustin,

      The first error message is related to our API backend. You can whitelist your server’s IP for API access inside our Control Panel by going to Account -> API -> Whitelist IP.

      The second error message you get is related to your pull zone’s settings. Could you please send us more details to support@maxcdn.com so that we can check this out for you in more detail?

  • http://www.pro-tools-pc.com/ Neil Hester

    Hi,
    Is there built in image optimisation to MaxCDN when using with wordpress?
    I have an image optimisation (resizing and compression) plugin installed on my wordpress site but i don’t think its optimising the content that MaxCDN is serving because if i use google pagespeed tool to analyse my sites speed its saying i need to optimise my images to increase the page load times.
    The reason my images were not optimised before uploading is that i built the site while learning and didnt understand those kind of things back then but to go back through all my un-optimised content from many posts and manually optimise would be a nightmare to have to do.
    So i’d like my Max CDN content to be auto optimised. – Is this possible?
    Thanks!

    • Stefan

      Hello Neil.

      Being that a Pull Zone is a reverse proxy system, it will replicate files in the same way as they are on the source. So in general a Pull Zone cannot perform any image optimizations.

      You can optimize your image files via plugin for WordPress (eg. Imsanity) or by using some pro grade tool like Photoshop. Upon editing your files please do not forget to purge those specific files from your Pull Zone so that we can re-cache updated versions of the same files.

      One more tip, Pagespeed is a test tool more focused on the coding of your website and not the actual speed (load time).

      Please feel free to reach out to us via live chat or send an email to support@maxcdn.com so we can help you with any CDN question.

      Keep us updated!

      • http://www.pro-tools-pc.com/ Neil Hester

        Hi Stefan,
        Thanks very much for your reply.
        I’ve actually just run an image optimiser plugin and purged the CDN cache so hopefully that has helped.
        thanks for the pagespeed tip, it was just complaining that images were large and un-optimised which led me to look into it further but you’ve certainly pointed me in the right direction and i’ll come back to you if i still have problems.
        Thanks again !

  • http://www.pluginfusion.com pluginfusion.com

    HI, I have switched my site to https and reactivated maxcdn via w3 total cache and css of the site broke. Turned off cdn and the site is fine. Than I used another cdn integration plugin and it seemed to work fine but when a user log in can’t access the files (it says; You must be logged in to download files). Any ideas? Thnx!