After Moving Your WordPress Site: How to Find and Fix Every Broken Internal Link

You’ve migrated your WordPress site: new domain, new host, maybe HTTP to HTTPS. Everything looks fine. Then you start clicking. Images are missing. Buttons go nowhere. Your internal links are a maze of 404 errors.

This happens because WordPress stores full URLs in posts, menus, widgets, custom fields, and page builders. When you move, those hardcoded links don’t update automatically, while core settings like Site URL and permalinks usually survive, everything else can break.

The good news? You don’t have to fix them manually. Here’s how.

Before You Do Anything

  1. Keep the old site live for 48 hours (if possible) as a fallback.
  2. Take a fresh backup of your new site’s database and files.
  3. Work on a staging site if you can: never test link fixes on a live production site first.

Finding Broken Links: 3 Methods

Method 1: Screaming Frog (Best for large sites) – Free for up to 500 URLs. Crawls your entire site and shows every 404.

Method 2: Online Broken Link Checkers – Tools like Dr. Link Check or W3C Link Checker. Quick but less thorough.

Method 3: Google Search Console – Go to Coverage → Errors → 404. Shows what Google found.

Quick manual check: After migration, click around your main pages, blog posts, shop, and menus. Note any 404s.

Fixing Links in Bulk (The Safe Way)

The Golden Rule: Never search/replace raw in the database

WordPress serializes data (stores string lengths). A raw search/replace will corrupt your database.

The Right Tools:

Option 1: Better Search Replace (free plugin)

  • Install and activate.
  • Search for http://oldsite.com
  • Replace with https://newsite.com
  • Select all tables.
  • Run as a dry run first → then run live.
  • Safe for serialized data.

Option 2: WP CLI (for developers)

wp search-replace 'http://oldsite.com' 'https://newsite.com' --all-tables

Option 3: Migrate DB Pro or WP Migrate (paid) – Handles serialization perfectly. Great for complex migrations.

Manual Fixes for Stubborn Cases

Some links won’t be caught by bulk search/replace:

Navigation menus: Go to Appearance → Menus. Check each custom link. Update manually.

Widgets: Appearance → Widgets. Open each widget (especially Text and Custom HTML). Update URLs.

Page builder content: Open each page in Elementor, Beaver Builder, or WPBakery. Resave the page — many builders rewrite URLs on resave.

Hardcoded theme files: Search your theme folder for oldsite.com. Update manually or via your IDE’s “Find in Files.”

Block editor links: Open affected posts. Click on linked blocks. Update the URL in the block settings.

The Hidden Danger: Database Serialization

WordPress stores some data as “serialized”, it includes the string length. If you do a raw search/replace, changing the URL length corrupts the data.

Tools like Better Search Replace and WP CLI handle this automatically. Never use phpMyAdmin’s raw search/replace unless you absolutely know what you’re doing.

After the Fix: Validation Checklist

  • Resave permalinks (Settings → Permalinks → Save Changes)
  • Clear all caches (plugin cache, CDN, browser)
  • Run Screaming Frog again: confirm zero internal 404s
  • Check Google Search Console: no new 404 errors after 48 hours
  • Test key user journeys: Homepage → product/post → checkout/contact
  • Check images on a few random posts

Prevention: Migration-Ready Link Strategies

For your next migration:

  • Use relative paths when linking internally: /contact/ instead of https://site.com/contact/
  • Use the WordPress home_url() function in theme files instead of hardcoded URLs
  • Store only relative paths in custom fields when possible
  • Document every place you’ve hardcoded URLs

Final Thoughts

Broken internal links after a migration are normal. They’re fixable. The key is using the right tool, one that respects serialized data.

Remember the golden rules:

  1. Always back up before touching the database
  2. Never use raw search/replace in phpMyAdmin
  3. Always run a dry run first
  4. Test on staging before production

Fix your links once, correctly, and your migrated site will run better than the original.

Was this post helpful?
Buy us a coffee!