Connect with us

How to change your WordPress Domain?


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, ‘’, ‘’) 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, ‘’, ‘’);
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.

Continue Reading
Click to comment

Leave a Reply

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

More in blogging

About Me:

Szabi Kisded

Hey there, I'm Szabi. At 30 years old, I quit my IT job and started my own business and became a full time WordPress plugin developer, blogger and stay-at-home dad. Here I'm documenting my journey earning an online (semi)passive income. Read more

Sign up for my newsletter and get the YouTube Caption Scraper WordPress plugin for free
(worth 29$)!

All My Plugins In A Bundle:

My AutoBlogging Plugins:

My Online Courses:

A Theme I Recommend:

Featured Posts:

To Top