How To Replace URLs in WordPress in 5 Minutes

In this article, I’m going to show you how to instantly replace all URLs in your WordPress website and database using a single plugin. Before proceeding, ensure that you have access to your WordPress admin dashboard.

Let’s say you host all of your website’s images on an external site like Dropbox. But one day you open your website and discover that none of the images are being displayed because the external site changed its domain name for some reason, rendering all the URLs in your website invalid.

Now you have to update all of the links in your website to match the new domain. If the links aren’t that many, you might easily update them one by one. But if you have hundreds or thousands of such external links, it could take you hours(or even days) to change all of them manually.

Replacing URLs in Your Database

Please make a backup of your website before using this plugin to update URL or text. That way, if anything goes wrong, you can easily restore the backup and get your website working again. 

If you don’t know how to back up your website in WordPress, check out our detailed guide here.

Now, to change the URL or text in your site, click on Tools in the sidebar, then click Better Search Replace. You’ll find a page similar to the one in the image below(under the“Search/replace” tab).

Better Search replaceBetter Search replaceBetter Search replace
Better Search replace

Inside the text box for Search for, type in the URL you want to replace in your database. Then provide the new value you want to replace the old value with under Replace with. If you only want to make the change in specific tables, select the tables. Otherwise, highlight all of the tables.

Below the Search/Replace box, you’ll find the Additional Settings box. 

Plugin settingsPlugin settingsPlugin settings
Plugin settings

Here you can make the search case-insensitive(captures both uppercase and lowercase of the search term). 

When you use the Run as dry run option, it first shows you the details such as the tables and cells that are going to be updated. If you’re satisfied with the result, you can then untick Run as dry run and click the Run Search/Replace button again to make the actual changes.

Once the process is completed, you’ll get a message telling you how many tables and cells in the database were updated. You can then go to your website and confirm if the links have been correctly updated. 

Plugin Settings

The Max Page size setting allows you to adjust the maximum page size to suit your website needs. The maximum allowed value is 20,000. But if you notice timeouts or are unable to backup/import the database, try decreasing this value.

Conclusion

Using a plugin to change URLs in a database in WordPress is a great way to quickly and effectively update the URLs of your website. This process is easy and efficient, and can be done without having to manually update each URL. With the right plugin, you can also make sure that all of your existing links are updated as well. This makes it easier to keep your website up to date and is a great way to ensure that your customers have a great experience.