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.
Click into the Perfmatters plugin settings.
Click on the “CDN” submenu.
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
- If the URLs of your WordPress site end in
.htmlyou will want to add that extension.
Scroll down and click “Save Changes.”
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:
Another example would be a downloadable product in WooCommerce. The file format used in emails will look something like this:
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.