Skip to content
Follow
CMS Ubuntu Linux

How to Rebrand (or Change Domain Name) in WordPress

Richard
Written by
Richard
Jul 28, 2022 Updated Jun 20, 2026 4 min read
How to Enable or Disable Microsoft Defender Cloud Protection
How to Enable or Disable Microsoft Defender Cloud Protection

You can rebrand or change your WordPress website’s domain name by updating its core settings and ensuring proper redirection.

Changing a domain name involves telling WordPress and your server about the new address, making sure visitors and search engines find your site at the new location.

This is essential for a smooth transition when your brand evolves or you secure a better web address. I recently managed this for GeekRewind.com, switching its domain in less than sixty minutes.

You can perform this domain change yourself if you have full server access, such as through SSH or a direct file manager connection.

⚡ Quick Answer

Change your WordPress domain by registering a new domain, pointing it to your host, creating a new server block or virtual host, updating your WordPress database with the new URL, and ensuring proper redirects.

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

First, you need to get the new web address you want for your WordPress site; this is called registering a domain name.

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

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

After registering your new domain name, you’ll need to set up a place on your web server for it, which is called a virtual host for Apache or a server block for 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. websitesforstudents.com will be redirected to the new domain geekrewind.com:

💻Code
server {
        listen 80;
        listen [::]:80;
        server_name geekrewind.com www.geekrewind.com;
        return 301 https://$host$request_uri;

        include snippets/well-known.conf;
}

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name www.geekrewind.com;

        return 301 https://geekrewind.com$request_uri;

        include snippets/well-known.conf;
        ........................................
        ........................................
}

server {
        listen 443 ssl http2;
        listen [::]:443 ssl;
        server_name geekrewind.com;
        
        return 301 https://geekrewind.com$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 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

Now, you must update your WordPress site’s database to tell it about the new domain name, changing all the old web addresses to the new ones.

Sign on to your MySQL server.

🐧Bash / Shell
sudo mysql -u root -p

Type a password or press Enter to log on.

There, change to your WordPress database.

💻Code
use wpdatabse;

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

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

That will display lines similar to the one below:

💻Code
+-------------+------------------------------------+
| option_name | option_value                       |
+-------------+------------------------------------+
| home        | https://geekrewind.com     |
| siteurl     | https://websiteforstudeents.com    |
+-------------+------------------------------------+
2 rows in set (0.00 sec)

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

💻Code
UPDATE wp_posts SET guid = replace(guid, 'https://geekrewind.com','https://geekrewind.com');

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

💻Code
UPDATE wp_posts SET post_content = replace(post_content, 'https://geekrewind.com', 'https://geekrewind.com');

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

💻Code
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'https://geekrewind.com', 'https://geekrewind.com');

Exit the database console.

Double-check your work

After making all the changes to move your WordPress site to a new domain, it’s important to double-check everything to make sure it’s working correctly.

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

That should do it!

Conclusion:

  • Changing a domain name in WordPress involves several crucial steps to ensure a smooth transition.
  • Register a new domain name and update DNS records to the current server host IP.
  • If applicable, create a new virtual host or server block to handle the new domain and ensure SSL certificate configurations.
  • Update the WordPress database to replace all instances of the old domain with the new one.
  • Double-check all changes made and restart the server to ensure proper functionality.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install Actual Budget on Ubuntu 24.04
Ubuntu Linux How to Install Actual Budget on Ubuntu 24.04
How to Install Windows Subsystem for Linux (WSL) on Windows 11
Ubuntu Linux How to Install Windows Subsystem for Linux (WSL) on Windows 11
How to Allow Remote Connections to MySQL Database Server
Ubuntu Linux How to Allow Remote Connections to MySQL Database Server
How to Add a User to Sudoers in Ubuntu
Ubuntu Linux How to Add a User to Sudoers in Ubuntu

No comments yet — be the first to share your thoughts!

Leave a Comment

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