Cache Custom Directories with W3TC & MaxCDN

Are you struggling to get your newly created assets, such as images or CSS files, cached by MaxCDN within your WordPress site? If so, you’re not alone. Many people assume that MaxCDN will automatically cache any new assets they add to their custom directory within a WordPress template, page, or post. However, this is not the case. In order for MaxCDN to cache these assets, you need to let it know about the new directory you’ve created.

Fortunately, if you’re using the W3 Total Cache plugin, this process is relatively simple. Here’s what you need to do:

Step 1: Enable Custom File Hosting

First, navigate to the “Performance” tab in your WordPress dashboard and select “CDN.” Scroll down until you see the “Host custom files” checkbox and make sure it’s ticked.

Step 2: Add Your Custom Directory

Next, scroll down further until you see the “Custom file list” field. This is where you’ll need to add the name of your custom directory. For example, if your custom directory is located within the same directory as your WordPress install (which is usually the site’s root directory), simply add the name of the directory followed by an asterisk. The asterisk tells MaxCDN to cache everything within that folder.

Once you’ve completed these steps, all assets contained within your custom directory should now be cacheable by MaxCDN. To check whether or not your assets are being cached, simply load the page or post in which they’re referenced in a browser and check the source code. If they’re being cached, you should see the URL of the CDN within the URL that references the asset.

While this process may seem relatively straightforward, it’s important to note that it’s an advanced topic that may only interest a few hard-core performance geeks. However, if you’re looking to optimize your WordPress site’s performance and speed, it’s definitely worth taking the time to ensure that your assets are being cached properly by MaxCDN.

Stay in Touch


Related Articles