You are viewing the legacy StackPath SecureCDN Help Center. Please use support.stackpath.com if you signed up after July 1, 2018 or log in through control.stackpath.com

StackPath Support

WordPress with W3 Total Cache(w3tc): StackPath CDN Setup Guide

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.

Installation

  1. Log in to the WordPress control panel (/wp-admin):

    Wordpress admin panel login

  2. On the left-hand sidebar, hover over Plugins and select Add New:

    Wordpress plugins panel

  3. In the plugin search box, type W3 Total Cache. Then press Enter on your keyboard:

    Wordpress plugin search box

    The W3 Total Cache plugin will appear:

    W3 total cache plugin

  4. Click Install Now

  5. After W3 Total Cache is installed, click the Activate Plugin link

Configuration

  1. 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:

    Wordpress performance panel

  2. 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.
    w3tc page cache box

  3. 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. 

    w3tc minify settings

    We do not recommend changing any of the other settings under the Minify section. 

  4. 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.

    W3tc database cache options

  5. Enable object and browser caching:

    w3tc object cache options

    w3tc browser cache options

  6. 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


    w3tc cdn options
  7. Click Save all settings.

  8. Navigate to Performance and select CDN:

    w3tc cache performance options

  9. In the General section, select the file types to host on the StackPath CDN. To get SEO benefits, also check Add Canonical Header:

    w3tc cdn general section options

    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.

  10. 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.

    w3tc cdn hostname options

    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.

    Screen_Shot_2017-11-15_at_3.18.43_PM.png

  11. Click Save All Settings.

Test if SecureCDN is integrated correctly

Checking if CDN enabled is really simple. 

  1. Purge the browser cache
  2. Open the website
  3. Right click 
  4. View source code
  5. Check the source code for the CDN URL    

Optimization

  1. Select Browser Cache under the Performance menu in WordPress:

    w3tc browser cache options

  2. 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
  3. Click Save All Settings.

  4. Select Minify under the Performance menu in WordPress.

  5. At the top of the page, click HTML & XML.

  6. Check the Enable box next to next to HTML minify settings:

    w3tc minify options

    Adjust the other settings as you see fit.

  7. Click Save All Settings.

Using the StackPath WAF?

If you are using the StackPath WAF, be sure to follow this article, that will show you how to ensure you are able to update your website from your /wp-admin.  

Test speed and SEO after SecureCDN is enabled

At this time, you should perform another speed test by using Google Page Speed and Pingdom Tools.

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.

 

 

Return to top