How to Rebrand (or Change Domain Name) in WordPress
You can rebrand or change your WordPress website's domain name by updating core settings and ensuring proper redirection, which prevents broken links and helps search engines find your new address.
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.
Changing a WordPress domain name is essential for a smooth transition when your brand evolves or you secure a better web address. I recently managed this domain change 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.
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
Registering a new domain name is the first step to rebrand your WordPress site with a new web address. This new domain needs to point to the same server where your current website is located. If you’re not sure how to do this, there are guides available to help you register a domain name easily.
If you haven’t registered a domain name before, the post below shows you how.
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 getting your new domain name, you need to set up a special space on your web server for it. This is called a virtual host if you’re using Apache, or a server block if you’re using Nginx. Guides can help you create one if you haven’t done this before.
If you have not yet created a virtual host or server block, this section explains the process. A virtual host or server block acts like a separate website on your server, allowing you to manage multiple sites from one IP address. Following these steps ensures your new domain name correctly points to your WordPress installation.
Your WordPress environment may have unique parameters and definitions that differ from other setups. For instance, a multisite installation will include specific configurations distinct from a single-site setup, affecting how you approach rebranding or changing your domain name.
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:
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
- How to request Let’s Encrypt SSL certificates with Nginx
- How to request Let’s Encrypt SSL certificates with Apache
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
Updating your WordPress database is key to changing all your old website addresses to your new domain name. You’ll need to log into your MySQL server and run specific commands to update your site’s URLs within the database. You can check current URLs before you make any changes.
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 | https://geekrewind.com | | siteurl | https://websiteforstudeents.com | +-------------+------------------------------------+ 2 rows in set (0.00 sec)
UPDATE wp_posts SET guid = replace(guid, 'https://geekrewind.com','https://geekrewind.com');
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:
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'https://geekrewind.com', 'https://geekrewind.com');
Exit the database console.
Double-check your work
After moving your WordPress site and updating the database, it’s important to double-check that everything is working right. Once you’re sure everything is functioning as expected, restart your web server, whether it’s Nginx or Apache, to finalize the changes and apply all updates.
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?
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.
No comments yet — be the first to share your thoughts!