Skip to main content
Category

Blog

Updating WordPress MySQL Database After Moving to a New URL

If you have ever moved your WordPress site to a new host or a new domain, you may have encountered some issues with your URLs. For example, your images may not load properly, or your links may point to the old site. This is because WordPress stores the site URL and the home URL in the database, and they need to be updated when you change your site location.

There are several ways to update your WordPress URLs in the database, but one of the easiest and most reliable methods is to use a SQL query. A SQL query is a command that you can run on your database to perform a specific task, such as changing or deleting data.

In this blog post, I will show you how to use a SQL query to change and update your WordPress URLs in the database when you move your site to a new host. This method works for any type of WordPress site, whether it is a single site or a multisite network.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

Email Signature

iSolution India Team
iSolution India Team
Business Development
M +91 6372151875 / 9040036500 / 7609960949

Rating stars
Rating text

This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information and must be protected in accordance with those provisions. Any unauthorized review, use, disclosure or distribution is prohibited.If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.