Connect with us

How to change your WordPress Domain?

blogging

How to change your WordPress Domain?

This is a problem that many users face sometimes, moving WordPress domains is not an easy task because you have many things to consider, if you just move your files and don’t change the correct configurations in the database you will break everything on your site, another common problem is that after you migrate to the new server your internal links (the ones created in the posts) may also be pointing to the old domain.

Now imagine if you have hundreds of posts to change? Would be to cost, time-wise, to go through all those posts changing link by link, also there are some options related to the domains and links that are created once WordPress is installed and there is no easy way to change it trough the admin.

The solution that address both of this problems is through some easy SQL queries that will do all the hard work for you:

First you need to set the new domain on your wp_option database

UPDATE wp_options SET option_value = replace(option_value, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

Finally, lets check through the post content and update the link

UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’);
If you look for the database after those changes you might find some remaining text pointing to the old domain, but normally those files are transient (cache) files so you don’t have much to worry about.

That’s pretty much all you need to, for any questions or help feel free to leave a comment bellow.

Click to comment

Leave a Reply

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

More in blogging

To Top
Grab the largest plugin bundle from CodeCanyon!