Change old URLs after the domain change

I have setup wordpress on my server, and after some time I’ve changed the domain name of the installation. However, all of the old urls within the site point to the old domain. How can I change old urls to match the new domain without breaking the database?

Here’s what I did:
I went to settings -> general
I’ve changed the site url and wordpress address (url).

The directory in which the wordpress installation is residing stayed the same.

How do I change all the old link? I was recommended using the UpdraftPlus migration feature, but I don’t see how would this affect the old links. I’d use wp search-replace i.e. wp cli, but I’m not sure if that tool will change all GUIDs (I’ve read that GUID should not be changed, but I’m not sure if I need to).

For future visitors: I’ve resolved the issue using wp-cli:

wp search-replace 'example.net' 'example.com' --skip-columns=guid

Use --dry-run for the sake of your sanity.

3 Answers
3

Two possible easy ways to replace Old website URL to New Website URL:

1/ Directly replace in SQL file:
Export the database and open SQL file. Manually find and replace old website URL with new website URL. Once replace is done, save and import database again.

2/ Use Migrate DB plugin:
Use the third-party WordPress plugin ‘WP Migrate DB‘ and find & replace both website URL and file path as shown in below screenshot. You can also replace other website data like admin email using this plugin.

WP Migrate Lite – WordPress Migration Made Easy

enter image description here

Leave a Comment