CDN Mapping

Extend WP Ghost’s path changes to your CDN domain so assets served from cdn.yourdomain.com use custom paths too. By default, WP Ghost changes paths only for your local domain. If you use a CDN, your static assets – images, stylesheets, scripts – are served from a different domain. Without CDN Mapping, those CDN URLs still contain default WordPress paths like /wp-content/ and /wp-includes/. CDN Mapping tells WP Ghost to apply the same path replacements to your CDN domain, closing this gap.

What Is CDN URL Mapping?

What is CDN URL Mapping in WP Ghost and how it extends path changes to CDN domains

A Content Delivery Network (CDN) is a distributed server network that delivers your site’s static files (images, CSS, JS) from servers geographically closer to each visitor. CDN plugins rewrite your asset URLs from your local domain to a CDN domain – for example, from yourdomain.com/wp-content/uploads/image.jpg to cdn.yourdomain.com/wp-content/uploads/image.jpg.

CDN URL Mapping in WP Ghost registers your CDN domain so WP Ghost applies the same path changes to CDN URLs as it does to local ones. Once configured, if WP Ghost changes /wp-content/ to /custom-path/ on your local domain, it also changes cdn.yourdomain.com/wp-content/ to cdn.yourdomain.com/custom-path/.

Here’s a concrete example of how it works:

Without CDN Mapping:
yourdomain.com/custom-path/uploads/image.jpg (local – path changed)
cdn.yourdomain.com/wp-content/uploads/image.jpg (CDN – original path exposed)

With CDN Mapping:
yourdomain.com/custom-path/uploads/image.jpg (local – path changed)
cdn.yourdomain.com/custom-path/uploads/image.jpg (CDN – path changed too)

Note: WP Ghost does not add CDN functionality to your site. CDN Mapping only modifies paths for CDN domains that are already configured through your CDN plugin or hosting provider.

Why CDN Domains Need Path Changes Too

This is a commonly missed step. Here’s why CDN Mapping matters for your hack prevention strategy:

CDN URLs bypass WP Ghost’s default path rewriting. WP Ghost scans the HTML output for URLs matching your local domain and replaces the paths. CDN URLs use a different domain – cdn.yourdomain.com, i0.wp.com, or a custom Cloudflare/BunnyCDN subdomain. WP Ghost doesn’t recognize these as your domain, so it leaves them untouched. The result: your local URLs use custom paths, but every CDN-served asset still shows /wp-content/, /wp-includes/, and plugin names in the source.

CDN-served assets are the majority of your page. On a typical WordPress page, images, stylesheets, and scripts make up 80–90% of the URLs in the source code. If your CDN serves all of these, most of your page source contains CDN URLs – which means most URLs in the source are unchanged. A scanner sees dozens of /wp-content/ references on the CDN domain and identifies WordPress instantly.

One unmatched domain undoes all your path changes. You’ve changed wp-content, hidden plugins, renamed themes. But if the CDN domain still serves from /wp-content/plugins/woocommerce/, none of that matters. CDN Mapping ensures consistency across all domains.

How to Configure CDN URL Mapping

WP Ghost automatically detects CDN domains for several popular plugins. If yours isn’t detected, add it manually.

Activate a Security Level

CDN Mapping requires Safe Mode or Ghost Mode to be active.

  1. Go to WP Ghost > Change Paths > Level of Security.
  2. Select Safe Mode or Ghost Mode.
  3. Click Save to apply.
WP Ghost Level of Security selection showing Safe Mode and Ghost Mode

Add Your CDN Domain

  1. Go to WP Ghost > Mapping > CDN.
  2. If your CDN domain is already listed (auto-detected), no action needed.
  3. If not listed, enter your CDN domain (e.g., cdn.yourdomain.com).
  4. Click Save to apply.
WP Ghost CDN Mapping section showing CDN domain input field

After saving, open your site in a private browser window and view the page source. Search for your CDN domain and check the paths – they should now use your custom paths instead of default WordPress directories.

Supported CDN Plugins

WP Ghost automatically detects CDN domains configured by these popular plugins – no manual entry required:

WP Rocket – CDN domain detected from WP Rocket’s CDN configuration. CDN Enabler – CDN domain detected automatically. Bunny CDN – BunnyCDN pull zone domain detected. EWWW Image Optimizer – CDN domain for optimized images detected. JCH Optimize – CDN path detected from JCH settings. Power Cache CDN, WP Cache CDN, and Hyper Cache CDN are also supported.

If your CDN plugin isn’t in this list, or if WP Ghost doesn’t detect your CDN domain automatically, add it manually in the CDN section. See the full plugin compatibility list for details.

Frequently Asked Questions

Does this work with Cloudflare?

Cloudflare operates differently from traditional CDNs – it proxies your entire domain rather than using a separate CDN subdomain. Because Cloudflare-served URLs use your own domain (not a separate CDN domain), WP Ghost’s standard path changes already apply to them. You typically don’t need CDN Mapping for Cloudflare. CDN Mapping is for CDN setups that use a different domain or subdomain for asset delivery.

Do I need this if I don’t use a CDN?

No. If all your assets are served from your local domain, WP Ghost’s standard path changes cover everything. CDN Mapping is only needed when your page source contains URLs with a different domain than your main site.

Does CDN Mapping affect CDN performance?

No. CDN Mapping only changes the URL paths in your HTML source code. The CDN continues serving files from its edge servers as normal. The path change happens in the HTML output, not on the CDN infrastructure. Performance is unaffected.

Does this work with WooCommerce product images on CDN?

Yes. WooCommerce product images served via CDN have their paths changed like any other asset. The CDN domain URL is rewritten with custom paths, so cdn.yourdomain.com/wp-content/uploads/product-image.jpg becomes cdn.yourdomain.com/custom-path/uploads/product-image.jpg. WP Ghost is fully compatible with WooCommerce.

Does WP Ghost modify WordPress core files?

No. CDN Mapping replaces URLs in the HTML output at runtime. No files on your server or CDN are modified. Disabling CDN Mapping restores all original CDN URLs instantly.

Ensure path consistency across all domains and caching layers: