The CDN rewrite option allows you to easily use third-party CDN providers on your WordPress site. Rewrite means that it will automatically change all of your assets’ URLs on the fly to use the CDN URL. This way, your assets will load from all of the global CDN POPs, instead of just your server.
A few popular CDN providers we recommend include:
If you’re using Cloudflare you don’t need to do anything in Perfmatters. Cloudflare is different than traditional CDN providers and sits between your site and the public internet. Traffic is automatically routed through Cloudflare, and it doesn’t require a custom CDN URL. Make sure to check out our documentation on recommended Cloudflare settings for the best performance.
Enable CDN rewrite
Follow the steps below to enable CDN rewriting of your URLs.
Click into the Perfmatters plugin settings.
Click on the “CDN” submenu.
Toggle on “Enable CDN Rewrite.” Note: Make sure to first configure your CDN URL.
Scroll down and click “Save Changes.”
Important: If you’re testing on a staging site, you’ll probably need to turn the CDN rewrite feature off temporarily as the CDN URL will only match your live site.
It’s not possible to rewrite background images stored in third-party stylesheets to the CDN since we don’t have access to those files (inline background images work fine). However, the theme or page builder you’re using should hopefully provide you with a way to do this. Elementor, for example, currently has an open issue regarding this. A temporary workaround for Elementor would be to use their “Replace URL” feature and update the background image URLs with the CDN URL versions.