Docs

Custom CDN URL

3 min readUpdated June 28, 2026

The Custom CDN URL option lets you point WP Media Cloud at any CDN or custom domain without needing a named integration. WP Media Cloud rewrites all media attachment URLs to use your custom hostname. There is no API connection, no bandwidth stats, and no automatic configuration — you enter a URL and the plugin uses it.

When to use Custom CDN URL#

Use Custom CDN URL when:

  • You are using a CDN that does not have a named integration in WP Media Cloud — such as Amazon CloudFront, Fastly, or any other provider
  • You are using Cloudflare CDN in front of a non-R2 storage provider via a proxied domain or Worker
  • You have a custom domain configured on your storage bucket (for example a custom domain on a DigitalOcean Space or a CNAME pointing to your Wasabi bucket)
  • You are running your own reverse proxy or cache layer in front of your storage bucket

If your CDN is Bunny CDN, KeyCDN, EWWW Easy IO, or CDN77, use the named integration for those providers instead. They offer API-connected bandwidth statistics in the Dashboard tab that the Custom CDN URL option does not provide.

How it works#

When a Custom CDN URL is set, WP Media Cloud replaces the storage bucket hostname in all attachment URLs with your custom hostname. The file path within the bucket remains unchanged. For example, if your bucket stores a file at the path 2026/06/photo.jpg and your custom CDN URL is https://media.yoursite.com, the URL WP Media Cloud generates is https://media.yoursite.com/2026/06/photo.jpg.

If no CDN URL is set, WP Media Cloud falls back to the storage bucket’s own public URL constructed from your bucket name and region. The custom CDN URL always takes priority over the fallback.

Configuring Custom CDN URL#

In your WordPress admin, go to WP Media Cloud > Settings and find the CDN section for your storage provider. Select Custom CDN URL as the CDN type. Enter your CDN hostname in the URL field including the https:// prefix. Do not include a trailing slash.

Save settings. All media URLs will immediately be rewritten to use your custom hostname.

Configuring via wp-config.php#

The custom CDN URL can also be set via a constant in wp-config.php. The constant name depends on your storage provider:

  • Amazon S3: define( 'WPMC_AWS_CDN_URL', 'https://your-cdn.com' );
  • Wasabi: define( 'WPMC_WASABI_CDN_URL', 'https://your-cdn.com' );
  • DigitalOcean Spaces: define( 'WPMC_DO_CDN_URL', 'https://your-cdn.com' );
  • Hetzner: define( 'WPMC_HETZNER_CDN_URL', 'https://your-cdn.com' );
  • Backblaze B2: define( 'WPMC_B2_CDN_URL', 'https://your-cdn.com' );
  • Google Cloud Storage: define( 'WPMC_GCS_CDN_URL', 'https://your-cdn.com' );
  • Cloudflare R2: define( 'WPMC_R2_CDN_URL', 'https://your-cdn.com' );
  • S3-compatible endpoint: define( 'WPMC_S3COMPAT_CDN_URL', 'https://your-cdn.com' );

You must also set the CDN type constant to custom for the CDN URL to be used. For example for Amazon S3: define( 'WPMC_AWS_CDN_TYPE', 'custom' );

Dashboard analytics#

The Custom CDN URL option has no API integration. The Dashboard tab will show your local offloaded file count but no bandwidth chart or CDN statistics. If you need bandwidth data in the Dashboard, switch to a named CDN integration.

Troubleshooting#

CDN URL is not rewriting
Confirm the URL is entered with https:// and without a trailing slash. Confirm the CDN type is set to Custom CDN URL and not left on None. Save settings and clear any page cache.

Files return 404 via the custom URL
Your CDN or reverse proxy is not correctly forwarding requests to your storage bucket origin. Test the origin bucket URL directly in a browser, then confirm your CDN configuration is routing requests to the correct origin. The file path after the hostname must match the path structure in your bucket.

Some images use the CDN URL and some use the bucket URL
Files that were cached by a page cache plugin before you configured the CDN URL will still have the old URL in cached HTML. Clear your page cache after configuring the CDN URL.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only