In this article we will go through how to setup your MaxCDN Integration using the popular WordPress Plug-in, W3 Total Cache.
This tutorial assumes you have already created a pull zone.
Installing W3 Total Cache
Log into your WordPress Admin Panel.
On the left-hand sidebar, hover your mouse over “plugins” and click “add new.”
In the search box, type “W3 Total Cache.” Then hit the search button.
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.
Install the plugin.
A message will pop up asking you if you're sure you want to install the plugin. Click “OK.”
Once the plugin has been installed, you'll need to activate it. Just click the “activate plugin” link to do so.
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
- Log into your WordPress Admin Panel. Scroll down to the “performance” link on the left-hand sidebar and select “general settings.”
- 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.
- In the next box down, enable the minify function by checking the box and selecting the “manual” mode.
- Database cache should be disabled, so make sure that the “enable” box is not selected.
- Check the boxes to enable object and browser caching.
- Enable CDN, and then select MaxCDN from the drop-down list.
- On the left-hand sidebar, look under “performance” and click on “CDN.” Now you can enter detailed CDN settings.
- In the “general” section, you can select which filetypes to host on CDN. To get SEO benefits, check the box for “add canonical header.”
- 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.
- 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.
- If you don’t yet have API generated, please follow this instruction page.
- Once you've entered your authorization key, you can enter your CDN domain into the “replace site's hostname with” field.
- 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.
- Hit the “test MaxCDN” button to make sure everything is in order.
- 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.
- Once you've done that, try clicking on “test MaxCDN” again. It should work this time.
- To finish up, click “save all settings.”
Tweaking the Config
- To tweak your browser cache, click on “browser cache” under the performance menu heading on the left-hand sidebar.
- 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.
- If you want to tweak minify, click on “minify” under the performance header on the left-hand sidebar.
- At the top of the page, click on the link for “HTML & XML.”
- You'll see the “HTML & XML” section, where you can check the box to enable HTML minify settings.
- 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.
Additional CDN Tweaks
- 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:
- 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:
Verify the Integration
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, webpagetest that can give you more detailed reports on your CDN implementation status.
Additional Notes from Support
- 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
- 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.
We hope this article was helpful. As always, If you have any questions or concerns about any of the topics mentioned in this article, please feel free to reach out to support - we are available 24/7 by chat or email!