In this article, we'll help you set up the W3 Total Cache (w3tc) plug-in with SecureCDN, and help you configure the plugin with the most common settings for best performance and security.
W3 Total Cache is a free CDN integration plugin that also features a host of other caching abilities, like Database Cache, Page Cache, Object Cache, Browser Cache and allows you to maximize the benefits of SecureCDN.
Before you begin, we highly recommend you test the performance of your site using Google Page Speed or Pingdom Tools. You can test your site now and after setting up the plugin for a before and after performance comparison.
This tutorial assumes you've already gone through the steps to create a Site in your SecureCDN account.
- Log in to the WordPress control panel (/wp-admin):
On the left-hand sidebar, hover over Plugins and select Add New:
In the plugin search box, type W3 Total Cache. Then press Enter on your keyboard:
The W3 Total Cache plugin will appear:
Click Install Now
After W3 Total Cache is installed, click the Activate Plugin link
Once W3 Total Cache is installed, a new menu item called Performance will appear near the bottom of the left-hand sidebar. Hover over it and select General Settings:
Scroll down to the Page Cache box. Check the Enable box to enable page caching and make Disk: Enhanced the selected method. Enhanced modifies the .htaccess file to direct Apache2 to a static(cached) version of the resource.
Enable the minify function and select Manual mode.
Minification is the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser. This setting will also improve your SEO.
We do not recommend changing any of the other settings under the Minify section.
We recommend keeping the Database Cache option Disabled.
This setting can actually slow down the time to first byte on your site and can cause other functions of your website not to work normally. Only advanced users should enable this feature.
Enable object and browser caching:
Enable the CDN feature and select Generic Mirror if you are using version 09.6 or higher.
***If you are using a version below 0.9.6, please select MaxCDN.
We are currently working to setup an official StackPath SecureCDN selection for the CDN type field. MaxCDN and StackPath are based on the same core technology and this will work correctly
Click Save all settings.
- Navigate to Performance and select CDN:
In the General section, select the file types to host on the StackPath CDN. To get SEO benefits, also check Add Canonical Header:
Please note that W3 Total Cache adds Canonical headers only to the image files so if you're serving other files as well, please disable this option and enabled in the Site CDN Settings.
To find your CDN domain/URL, go to the StackPath control panel. Select Manage > CDN > Settings. In Site Details, copy the address next to the CDN URL field. Now paste it into the Replace site's hostname with field in WordPress.
If you created a Custom Domain that CNAME's to the CDN URL in question, it can be entered in place of the CDN URL. To find the Custom Domain you created, go to Settings tab in the StackPath Sites CDN tab. The Custom Domain will be under the Custom Domain Settings section.
Important Note: The Authorization key isn't required to make the plug-in connect to your website. But if you still want to have that connection, you will need to create an API and paste the needed files(alias+key+secret) in the Authorization key section.
Click Save All Settings.
Test if SecureCDN is integrated correctly
Checking if CDN enabled is really simple.
- Purge the browser cache
- Open the website
- Right click
- View source code
- Check the source code for the CDN URL
Select Browser Cache under the Performance menu in WordPress:
Navigate to General to view browser caching features
Adjust the following settings accordingly:
- Enable Set Last-Modified header
- Enable Set expires header
- Enable Set cache control header
- Enable Set entity tag (eTag)
- Enable Set W3 Total Cache header
- Enable HTTP (gzip) compression
- DisableSet cookies for static files
- Enable Do not process 404 errors for static objects with WordPress
Click Save All Settings.
Select Minify under the Performance menu in WordPress.
At the top of the page, click HTML & XML.
Check the Enable box next to next to HTML minify settings:
Adjust the other settings as you see fit.
Click Save All Settings.
Test speed and SEO after SecureCDN is enabled
Compare the before and after tests and note that it can take one to seven days for your site to realize the performance improvements of a CDN. Both of these test sites also will give you SEO recommendations that you can follow.
How to disable CDN
If you encounter errors or are not pleased with the integration you can quickly disable the CDN. Please go to General settings and uncheck the CDN box and press Save settings and Purge cache.
In the event you have problems with the integration, we have 24/7 integration assistance via live chat by clicking our chat bubble at the bottom of this page! We are always happy to help answer questions and to help make sure you experience the fastest and most secure experience with SecureCDN.