Skip to content

Search & Replace

How to Change CDN Providers in WordPress URLs

When you switch CDN providers — say from cdn.oldhost.com to cdn.newhost.com — old asset URLs stay baked into your posts, pages, and options, so images and scripts keep pointing at the CDN you left. There is no separate "CDN" setting to flip; you fix it with a normal search and replace, swapping the old CDN host for the new one everywhere it appears. Update URLs does exactly that.

Why old CDN URLs get left behind

A CDN rewrite plugin usually changes asset URLs at page-render time, but the URLs stored in your database still contain the old CDN host. When you move to a new provider (or turn a CDN off), any URL that was hard-coded into content still points at the old host. Search and replace rewrites those stored URLs to the new host.

Before you start: find the exact old CDN URL

Get the precise string that appears in your content, not a guess. Open a page that loads a CDN asset, view source, and copy the CDN base — for example https://cdn.oldhost.com. Matching in Update URLs is case-sensitive by default, so match the exact casing that is stored.

  • Search For: https://cdn.oldhost.com
  • Replace With: https://cdn.newhost.com

Replacing the scheme-and-host portion (rather than a full file path) catches every asset served from that CDN in one pass.

Change CDN URLs with the free version

The free version runs a direct, whole-table SQL replace across the targets you tick. It is case-sensitive, has no preview, and is irreversible — so back up your database first.

  1. Go to Update URLS → Search & Replace.
  2. In Search For, enter your old CDN base URL (for example https://cdn.oldhost.com).
  3. In Replace With, enter your new CDN base URL (for example https://cdn.newhost.com).
  4. Under Where to Update?, tick the targets that hold your asset URLs — usually Content (post content) and Custom (custom fields / postmeta, where page builders store markup). Add Excerpts or Links if relevant.
  5. Leave Replace GUIDs off — GUIDs are feed identifiers, not asset URLs. See what a GUID is and when to replace it.
  6. Click Run Search/Replace.

The free replace can't be undone

The free version writes changes immediately with no preview and no undo. Back up your database before you run it. For a safer path, use the PRO dry run and undo below, or the PRO Backup & Import tool to create a restore point first.

Change CDN URLs safely with PRO

PRO adds a preview and a rollback, which matters when you are rewriting asset URLs site-wide.

  1. Go to Update URLS → Search & Replace.
  2. Enter your old CDN URL in Search For and the new one in Replace With.
  3. Under Select Tables, choose the tables that hold your content and options (for a normal site, wp_posts and wp_postmeta cover most asset URLs).
  4. Keep Run as dry run on (it is on by default) so nothing is written yet.
  5. If your page builder or a directory plugin stores JSON, leave Match escaped URLs in JSON data on so escaped-slash variants (https:\/\/cdn.oldhost.com) are matched too.
  6. Click Run Search/Replace to preview matches in the results table (Table / Column / Row / Before / After).
  7. Review the rows, then click Replace Selected or Replace All to apply.
  8. If anything looks wrong afterwards, reverse the run from Update URLS → History with Undo.

Don't forget non-content CDN references

Search and replace fixes URLs stored in your database. It does not change:

  • Your CDN rewrite plugin's configuration — update the CDN host there separately, or the plugin may re-rewrite URLs back to a host you no longer use.
  • Theme or plugin files that hard-code a CDN URL in code — those live on disk, not in the database.
  • DNS or CNAME records for a custom CDN subdomain — update those with your DNS provider.

Conclusion

Changing CDN providers is a search-and-replace job, not a dedicated setting: swap the old CDN host for the new one across your content and custom fields. In the free version, back up first because the change is immediate and irreversible; in PRO, use the dry run to preview and Undo to roll back. When you're done, confirm your CDN rewrite plugin and DNS point at the new provider too. See the full PRO search and replace workflow for more.

FAQs

Is there a CDN setting in Update URLs?

No. Update URLs has no CDN-specific option. Changing CDN providers is a standard search and replace where you set your old CDN host as the search value and your new CDN host as the replace value. This rewrites every stored asset URL that pointed at the old CDN, across the content and tables you select.

Should I replace the full asset path or just the CDN host?

Replace the scheme-and-host portion, such as https://cdn.oldhost.com, rather than individual file paths. Because the host prefix is shared by every asset from that CDN, one replacement updates all of them at once. Match the exact string and casing stored in your content, since matching is case-sensitive by default in Update URLs.

Will this break my images if I get it wrong?

It can, which is why you prepare first. In the free version the replace is immediate and irreversible, so take a database backup before running it. In PRO, run a dry run to preview the before/after rows, then apply, and use History → Undo if the result is wrong. Always verify the new CDN host actually serves your assets before rewriting.

Do I still need my CDN plugin after replacing the URLs?

Usually yes. Search and replace only fixes URLs already stored in the database. Your CDN rewrite plugin still handles new content and dynamically generated URLs, so update its configuration to the new CDN host as well. If you leave the old host configured there, the plugin may rewrite URLs back to the provider you just moved away from.

Was this page helpful?