How to Rebrand (or Change Domain Name) in WordPress

bram van oost ho3fDnfcKz8 unsplash scaled
bram van oost ho3fDnfcKz8 unsplash scaled

This post describes the steps one can take to rebrand or change a domain name in WordPress.

You may have noticed a name change if you have been on this site before. Before today, this site had a domain name, However, if you look at your browser address box, you will see

A redirect is in place to send all web traffic from to I will show you how I did it in under an hour.

If you have a website or blog built in WordPress, and you have full access to your server’s console via SSH or direct connection, then the step below will show you how to switch a domain or rebrand a website when using WordPress.

Changing a domain name in WordPress

As mentioned above, users can easily change or rebrand their websites hosted with WordPress, and the steps below describe the process.

Register a new domain name

Before migrating to a new domain, you’ll first register a domain name to which you want to switch.

If you haven’t registered a domain name before, the post below shows you how to do that.

How to register a domain name

Once you have registered the domain name, point the name to the same server host IP as your current website.

Create a new virtual host or server block

Once the name is registered, a DNS is updated to point to the same host (A record) IP; create a new virtual host when using Apache or server block if using Nginx.

If you haven’t created a virtual host or server block, below is how to do it.

Now each environment will be different. For example, yours might have unique parameters and definitions.

I use Nginx here. My new server block looks similar to the one below. will be redirected to the new domain

server {
        listen 80;
        listen [::]:80;
        return 301 https://$host$request_uri;

        include snippets/well-known.conf;

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        return 301$request_uri;

        include snippets/well-known.conf;

server {
        listen 443 ssl http2;
        listen [::]:443 ssl;
        return 301$request_uri;

        include snippets/well-known.conf;

I have three server blocks. The first one is simply redirecting HTTP to HTTPS. The second block redirects WWW to the new non-WWW domain. Finally, the last block redirects non-WWW to the new non-WWW domain.

Blocks with listen 443 and http2 definitions have Let’s Encrypt SSL certificate configurations for both new and old websites.

Below is how to request Let’s Encrypt SSL certificates

For the current website referenced in the current server block, replace all current domain names with new ones in the current server block file.

Update WordPress database

After creating a new server block and updating the current with a new domain name, go and update WordPress database tables and replace the current URLs with a new one.

Sign on to your MySQL server.

sudo mysql -u root -p

Type a password or press Enter to log on.

There, change to your WordPress database.

use wpdatabse;

Next, run the commands below to view the current URLs.

SELECT option_name, option_value FROM wp_options WHERE option_name IN ('siteurl', 'home');

That will display lines similar to the one below:

| option_name | option_value                       |
| home        |     |
| siteurl     |    |
2 rows in set (0.00 sec)

Next, run the commands below to update the values for the home and site tables.

UPDATE wp_posts SET guid = replace(guid, '','');

Next, run the commands below to update the post_content value in the wp_posts table:

UPDATE wp_posts SET post_content = replace(post_content, '', '');

Next, run the commands below to update the meta_value value in the wp_postmeta table:

UPDATE wp_postmeta SET meta_value = replace(meta_value, '', '');

Exit the database console.

Double-check your work

Once the changes above have been made, double-check your work to ensure you’re not missing anything.

If all is working, restart Nginx or Apache and hope all is well.

That should do it!


This post showed you how to rebrand or migrate to a new domain in WordPress. Please use the comment form below if you find any errors above or have something to share.

Posted by
Richard W

I love computers; maybe way too much. What I learned I try to share at

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: