How to Rebrand (or Change Domain Name) in WordPress – geek rewind

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

If you have been on this site before, you may have noticed a name change. Prior to today, this site had a domain name If you look at your browser address box, you will see

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

If you have a website or blog built in WordPress, and you have full access to your server’s console either via SSH or direct connection, then 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 change or rebrand their websites hosted with WordPress easily, and the steps below describe the process.

Register a new domain name

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

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

Once you have registered the domain name, make sure to 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 updated to point to the same host (A record) IP, go and 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. 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

I have three server blocks. The first one is simply redirecting HTTP to HTTPS. Second block is redirecting WWW to new non-WWW domain. The last block is redirect non-WWW to 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

The current website that is referenced in the current server block, make sure to replace all current domain name with new domain name in the current server block file.

Update WordPress database

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

Sign on to your MySQL server.

Type password or simply press Enter to logon.

There, change to your WordPress database.

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

That will display lines similar to the one below:

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

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

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

Exit the database console.

Double check your work

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

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

That should do it!

This content was originally published here.