How to Update Site URLs After Migrating WordPress

Geschätzte Lektüre: 4 Minuten

After migrating a WordPress website to a new domain, subdomain, or hosting provider, you may need to update your site’s URLs. If the old URLs remain in your configuration or database, visitors may encounter broken images, redirect loops, login problems, or links that still point to the previous domain.

This guide explains how to safely update your WordPress site URLs after a migration.

When Should You Update Site URLs?

Updating site URLs is necessary when:

  • Moving to a new domain name
  • Migrating from HTTP to HTTPS
  • Moving from a subdomain to the main domain
  • Migrating from a local development environment
  • Cloning a WordPress website
  • Restoring a backup on a different domain

Before You Begin

Before making changes:

  • Create a complete website backup.
  • Verify that the migration has finished successfully.
  • Confirm the new domain points to your hosting account.
  • Ensure your SSL certificate is active if using HTTPS.

Step 1: Update the WordPress Address

If you can access the WordPress dashboard:

  1. Log in to WordPress.
  2. Go to Settings → General.
  3. Update the following fields:
  • WordPress Address (URL)
  • Site Address (URL)

Example:

Old URL

http://old-domain.com

New URL

https://new-domain.com

Click Save Changes.

Step 2: Update the URLs in the Database

Changing the WordPress Address updates the site’s configuration, but existing content may still reference the old domain.

These may include:

  • Posts
  • Pages
  • Images
  • Internal links
  • Buttons
  • Widgets
  • Theme settings
  • Plugin settings

Update these references using a search-and-replace tool that supports WordPress serialized data.

Important: Do not perform a simple SQL text replacement, as it can corrupt serialized data stored in the database.

Step 3: Update the Home URL in wp-config.php (Optional)

If you cannot access the WordPress dashboard, you can define the site URLs in the wp-config.php file.

Add the following lines:

define('WP_HOME', 'https://new-domain.com');
define('WP_SITEURL', 'https://new-domain.com');

Save the file and reload your website.

Step 4: Regenerate Permalinks

After changing the site URL:

  1. Open Settings → Permalinks.
  2. Click Save Changes without modifying any settings.

This rebuilds WordPress rewrite rules and helps resolve 404 errors after migration.

Step 5: Clear Website Cache

If caching is enabled, clear:

  • WordPress cache
  • Server cache
  • Object cache
  • CDN cache
  • Browser cache

Cached pages may continue serving the old URLs until the cache is refreshed.

Step 6: Verify HTTPS Configuration

If your migration also included enabling SSL:

  • Confirm the website loads over HTTPS.
  • Verify all internal resources use HTTPS.
  • Check for mixed content warnings.
  • Ensure HTTP requests redirect to HTTPS.

Step 7: Test Your Website

After updating the URLs:

Verify that:

  • The homepage loads correctly.
  • The WordPress admin dashboard is accessible.
  • Internal links work.
  • Images display properly.
  • Forms submit successfully.
  • Plugins function normally.
  • Media files load without errors.

Common Issues After Updating URLs

Broken Images

Images may still reference the previous domain.

Update image URLs in the database using a WordPress-compatible search-and-replace tool.

Redirect Loops

Redirect loops can occur when:

  • WordPress URL settings conflict with server redirects.
  • CDN SSL settings are incorrect.
  • HTTP and HTTPS redirects overlap.

Review your server and CDN configuration to ensure redirects are applied consistently.

404 Errors

If pages return 404 Not Found after migration:

  • Regenerate permalinks.
  • Verify rewrite rules are active.
  • Confirm the migration completed successfully.

Login Redirect Issues

If the login page continually redirects:

  • Verify the WordPress Address and Site Address values.
  • Clear cookies and browser cache.
  • Check for conflicting redirect rules.

Verify the Migration

After completing the update:

  • Visit several pages across the website.
  • Test the login page.
  • Confirm media files display correctly.
  • Review contact forms.
  • Check WooCommerce functionality (if applicable).
  • Search for any remaining references to the old domain.

Best Practices

  • Create a backup before updating URLs.
  • Use HTTPS whenever possible.
  • Update all internal links.
  • Use a WordPress-aware search-and-replace tool for database updates.
  • Clear all caches after migration.
  • Test your website thoroughly before making it publicly available.

Frequently Asked Questions

Why are my images still loading from the old domain?

Image URLs are typically stored in the WordPress database. Updating the site address alone does not automatically replace existing content URLs.

Do I need to update both WordPress Address and Site Address?

Yes. In most cases, both settings should use the same domain unless you intentionally separate your WordPress installation from the public website.

Why shouldn’t I use a simple SQL replace?

WordPress stores some data in serialized format. A standard SQL replacement can corrupt this data, causing plugins or themes to malfunction.

Should I clear my cache after changing the site URL?

Yes. Clearing all caches ensures visitors receive the updated URLs instead of cached versions of the previous site.

Launchpad