How To Update WordPress Site Url After Changing to A New Domain

If you have moved your WordPress site to a new domain, updating the internal links and the image reference in the posts and pages seems inevitable so they can all be pointed to the new place. So, since updating them individually is impossible, how to update them in bulk and what’s the easiest way of doing it?

Update link against the database

Deep down, all post information are stored in the database table. So if you have access to the database that powers your site, you can run an Update query like below to quickly update the links and image references to the new domain.

UPDATE wp_posts SET post_content = REPLACE(post_content, 'old domain', 'new domain')

You can do the same against the Comments table so all comments can also be updated.

Update with a plugin

For those who don’t have access to the MySQL database or just don’t feel comfortable playing with the database tables directly, there is a pretty cool plugin called Velvet Blues Update URLs that you can use to achieve the same goal.

After having it installed and activated, go to Tools → Update URLs to start the process.

velvet-blues-update-urls-console

As you can see from the screenshot above, you have the options to update the URLs in the posts, pages, excerpts, links, attachments, etc..

It seems that using the plugin like Velvet Blue Update URLs does the job more thoroughly than running the query against the database directly.

So, that being said, if you want a thorough and easier solution to update URLs for a WordPress site, using the plugin is recommended.

One thought on “How To Update WordPress Site Url After Changing to A New Domain

Leave a Reply

Your email address will not be published. Required fields are marked *