StackPath Support

WordPress with W3 Total Cache: StackPath CDN Setup Guide

W3 Total Cache (w3tc) is a web performance plugin that helps manage caching inside WordPress. It comes with a built-in feature for integrating the StackPath SecureCDN.

This tutorial assumes a site is created

Installation

  1. Log in to the WordPress admin panel:

    Screenshot of WordPress admin panel

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

    Screenshot of WordPress plugin Add New option

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

    Screenshot of plugin search bar in WordPress

    The W3 Total Cache plugin will appear:

    Screenshot of W3 Total Cache install box in WordPress

  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:

    Screenshot of the W3 Total Cache general settings link in WordPress

  2. Scroll down to the Page Cache box. Check the Enable box to enable page caching and make Disk: Enhanced the selected method:

    Screenshot of W3 Total Cache page cache box

  3. In the next window down, check the Enable box to enable the minify function. Then select Manual mode:

    Screenshot of W3 Total Cache minify box

    Leave the other settings as is.

  4. The Database Cache should be disabled. Confirm that Enable box is NOT selected

    Screenshot of W3 Total Cache database cache box

  5. Enable object and browser caching by checking the Enable boxes in the Object Cache and Browser Cache windows:

    Screenshot of W3 Total Cache object cache box

    Screenshot of W3 Total Cache browser cache box

  6. In the CDN window, check the Enable box and select MaxCDN from the dropdown list:

    Screenshot of W3 Total Cache CDN box with MaxCDN selected

  7. Click Save all settings.

  8. Navigate to Performance and select CDN:

    Screenshot of the W3 Total Cache CDN link in WordPress

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

    Screenshot of the general section under the CDN tab in W3 Total Cache
    Please note that W3 Total Cache adds Canonical headers only to the image files so if you're serving other files as well, this option should be disabled in W3 Total Cache 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 the Site Details copy the address next to the CDN URL field. Now paste it into the Replace site's hostname with field in WordPress.

    In case you have 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.

  11. Click Save All Settings.

  12. Verify StackPath CDN is properly integrated.

Optimization

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

    Screenshot of the W3 Total Cache browser cache link in WordPress

  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:

    Screenshot of W3 Total Cache HTML and XML minify box

    Adjust the other settings as you see fit.

  7. Click Save All Settings.

 

Return to top