4

How To Replace URLs in WordPress in 5 Minutes

 11 months ago
source link: https://webdesign.tutsplus.com/how-to-replace-urls-in-wordpress-in-5-minutes--cms-106726t
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How To Replace URLs in WordPress in 5 Minutes

Kingsley Ubah Last updated Sep 13, 2023

Read Time: 3 min

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.

First, Install the Plugin

Follow these steps to install the plugin:

  • Sign into your WordPress admin dashboard
  • In the left sidebar,  click on Plugins, then click Add New
  • In the search box, type “Better Search Replace” and search
  • Once the plugin appears, click on Install Now, then click Activate

Now the plugin is active. Let’s use it to update URLs(or other text) in a database.

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 replace
Better Search replace
Better Search replaceBetter 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 settings
Plugin settings
Plugin settingsPlugin 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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK