Use code BLACKFRIDAY through Dec. 1st for 30% off!

CDN exclusions

There might be times when you need to add directories or file extensions to be excluded from CDN rewriting.

Add CDN exclusions

Follow the steps below to add CDN exclusions in Perfmatters.

Step 1

Click into the Perfmatters plugin settings.

Perfmatters plugin settings
Perfmatters plugin settings

Step 2

Click on the “CDN” tab.

Perfmatters CDN
Perfmatters CDN

Step 3

Add your exclusions in the CDN Exclusions field, separated by commas. These can be directories or file extensions. By default, the .php extension is excluded. You will want to leave this so that WordPress functions properly.

  • If you’re using the Yoast SEO plugin we recommend excluding the .xml extension.
  • If the URLs of your WordPress site end in .html you will want to add that extension.
CDN exclusions
CDN exclusions

Step 4

Scroll down and click “Save Changes.”

Make sure you have enabled CDN rewrite and added your CDN URL.

Excluding assets from the CDN based on strings

You can also exclude assets from the CDN based on a string.

For example, if you are using the OneSignal push notification plugin we recommend excluding their script: onesignal-free-web-push-notifications.

Another example would be a downloadable product in WooCommerce. The file format used in emails will look something like this: https://domain.com/?download_file=1234567

Depending on how you have your shop set up, it will email a link to your customers, allowing them to download the product without logging in again. However, if your product is getting rewritten on the CDN, this could break the authentication due to a subdomain being used (not matching the main domain).

You can add ?download_file to the exclusion list to ensure the products aren’t getting rewritten to the CDN. Or you could update the file of the product itself to include the CDN URL.

Was this article helpful?

Related Articles