October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Fix WordPress Redirecting to an Old Domain After Migration

A WordPress redirect after migration can come from URL settings, configuration constants, plugins, server rules, or stale database references. Trace the source and fix it safely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a migrated WordPress site still sends visitors to its old domain, first confirm the exact new address you want—including HTTPS, www or non-www, and any subdirectory—then trace the redirect through WordPress settings, configuration constants, plugins, server rules, and stored database references. Back up the site files and database before changing anything; the redirect may come from a layer other than WordPress’s two main URL settings.

Before changing anything: confirm the target and make a backup

Write down the full intended canonical URL, such as https://www.example.com or https://example.com/blog. The protocol, www choice, and any subdirectory matter. Confirm that the new domain points to the intended server and that you are editing the migrated WordPress installation—not a still-active copy on the old host.

As an Amazon Associate I earn from qualifying purchases.

Back up the WordPress directory, including images, plugins, and other site files, as well as the database. Keep a separate backup immediately before URL or database edits so you can restore the migrated site if a change has unintended effects. WordPress’s migration handbook recommends backing up both files and database when moving servers.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Correct the WordPress Address and Site Address

WordPress keeps two related addresses: the WordPress Address (URL), where the core files are installed, and the Site Address (URL), the public address visitors use. In the dashboard, open Settings > General and check both. If the dashboard is unavailable, the corresponding database options are siteurl and home in the installation’s wp_options table. Set them to the correct full addresses for the migrated installation.

With WP-CLI, inspect the current WordPress URL using:

wp option get siteurl

WP-CLI documents wp option update for changing an option; for example, after confirming the correct URL and database context:

wp option update siteurl 'https://example.com'
wp option update home 'https://example.com'

Substitute your actual canonical URL. Before running commands, make sure WP-CLI is operating on the migrated site and its intended database. WordPress’s migration instructions also describe updating home and siteurl when a site’s location changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check configuration overrides in wp-config.php

If the database values look right but the redirect persists, inspect wp-config.php for WP_HOME and WP_SITEURL. If either constant is defined, verify its value against the intended site address. A configuration constant can override the database option, so changing only home and siteurl may not resolve a mismatch.

A WordPress support-thread participant reported resolving a redirect by defining both constants with the new URL, but that is one installation-specific outcome, not a universal remedy. Change or add constants only when you have confirmed they are appropriate for your setup; preserve a copy of the file before editing.

Trace redirects from plugins and the server

When WordPress’s URL options and configuration constants match the new address, investigate other redirect layers rather than repeatedly editing the same values.

  • Redirect or migration plugins: Review active plugins and their redirect settings for a rule that sends the whole site—or a particular path—to the old domain.
  • .htaccess: If the site uses Apache and this file is present, inspect its redirect and rewrite rules. Back it up before changing rules, and avoid removing unrelated WordPress or host configuration.
  • Host or server configuration: Ask the hosting provider or developer to check server-level redirects if the rule is not in WordPress or .htaccess. A redirect can be applied before WordPress handles the request.

A support response lists WordPress URL settings, plugin rules, .htaccess, and database configuration as possible sources, but the visible redirect alone does not identify which one is responsible. The relevant source varies by installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Replace old-domain references in the database safely

Even after the main site address is corrected, old-domain URLs may remain in content, theme settings, widgets, or other stored values. That can cause old links or media paths without necessarily being the cause of a site-wide redirect.

Do not run a naive text replacement across the entire database. WordPress warns that serialized data can store string lengths; changing a URL without updating those lengths may corrupt stored values. Use a WordPress-aware method such as WP-CLI search-replace or a suitable URL replacement plugin, and keep the database backup made before the change.

WP-CLI lets you preview the proposed changes with --dry-run:

wp search-replace 'http://oldsite.com' 'https://example.com' --dry-run

Replace both example addresses with the actual old and new URLs, using the correct protocol. Review the preview and its scope before applying anything. If the changes are appropriate, run the same command without --dry-run. WP-CLI documents this preview-and-run workflow in its search-replace command reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Refresh caches and rewrite rules when appropriate

After correcting the source, stale cached values or rewrite state may affect what you see. WP-CLI documents these commands:

wp cache flush
wp rewrite flush

The first flushes the object cache; the second refreshes rewrite rules. WordPress also notes in its migration handbook that transients can contain old address references and may be removed from a migrated database copy so they can be recreated. These steps can clear stale state, but they will not remove an active plugin or server redirect rule.

Verify the destination and narrow any remaining redirect

Test the homepage, a representative internal page, and the administrative entry points using the intended domain. Confirm that the browser finishes at the expected address, and check that images, links, and permalinks still work. WordPress’s migration guidance calls out permalink reconfiguration and media links as items to check when a site’s location changes.

  • If every page redirects, recheck configuration constants, a site-wide plugin rule, and host/server redirects.
  • If only one path redirects, inspect plugin and server rules that target that path, along with any old links stored for that content.
  • If the browser reaches the new domain but individual links or images still point to the old one, investigate stored content and settings with a WordPress-aware replacement tool.

If the redirect remains after these checks, continue tracing the layer that issues it. Repeating broad database replacements will not fix a live redirect rule and can introduce database damage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.