How to Rebrand (or Change Domain Name) in WordPress
Rebranding in WordPress changes your website address across your database and core settings so visitors and search engines find your new location without hitting broken links. This migration takes under 60 minutes when you have direct access to your hosting files and database control panel . DNS changes can take longer to spread, but that waiting time is not hands-on work.
Careful planning keeps your site online and your search rankings safe during the switch. You need to update your address settings, configure automatic redirects, and check your database for old links before you finish.
Before you touch anything, take a full backup of your site files and your database. Every change below can be undone from a backup, and many cannot be undone any other way.
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, you can rebrand a WordPress site or move it to a new domain on your existing hosting. The steps below cover the whole process in order: register the domain, point it at your server, set up the web server, update the database, and test.
The steps assume you run your own server with Nginx or Apache and have shell and database access. On shared hosting with only a control panel , the DNS and database parts are the same, but the web server part is usually handled for you by an “add domain” or “alias” option.
Register a new domain name
Registering a new domain name is the first step when you rebrand a WordPress site. Buy your new web address through a domain registrar, then update its name servers or DNS records to point to your current web hosting server so visitors can reach the new address.
Check that the exact name you want is available, and consider also registering common variations. Keep the old domain registered and renewed. You need it to run the redirects, and letting it expire sends your old traffic and links to whoever buys it next.
If you haven't registered a domain name before, the post below shows you how.
Once you have registered the domain name, point it to the same server IP address as your current website. In your registrar's DNS settings, do the following:
- Find the DNS records (or DNS management) page for the new domain.
- Create an address record for the bare domain that points to your server's IP address. Add the same for the www name, either as an address record or an alias to the bare domain.
- Save the changes and wait for them to spread. This often takes a few minutes but can take several hours.
You can tell it has worked when the new domain reaches your server. It may show a default web server page or the old site, depending on your configuration. Don't request SSL certificates until the domain resolves to your server, because the certificate authority checks this.
Create a new virtual host or server block
Creating a new virtual host or server block tells your web server to accept traffic for the new domain name. Set up this configuration file in Apache (virtual host) or Nginx (server block) so it points to your WordPress folder.
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, so you can host several sites from one IP address. Once it is in place, your new domain name correctly points to your WordPress installation.
The two posts below walk through the setup for each web server. Follow the one that matches your stack.
Your WordPress environment may have its own parameters that differ from other setups. A multisite installation, for instance, stores domains in extra database tables and has its own configuration. That changes how you rebrand or change the domain, so a single-site walkthrough like this one will not cover it fully. If you run multisite, take extra care and test on a copy first.
I use Nginx here. My new server block looks similar to the one below. The old domain, websitesforstudents.com, is 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;
listen [::]:443 ssl;
http2 on;
server_name www.geekrewind.com;
return 301 https://geekrewind.com$request_uri;
include snippets/well-known.conf;
........................................
........................................
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name geekrewind.com;
return 301 https://geekrewind.com$request_uri;
include snippets/well-known.conf;
.........................................
.........................................
}This file has three server blocks:
- The first block redirects HTTP to HTTPS.
- The second block redirects the WWW address to the new non-WWW domain.
- The last block redirects the old non-WWW address to the new non-WWW domain.
These redirects should be permanent (301) redirects. That tells search engines the move is permanent so they transfer the old page's ranking to the new address.
The blocks with the listen 443 and http2 definitions hold the Let's Encrypt SSL certificate settings for the new and old websites. The old domain needs a valid certificate too. Without one, visitors who open an old HTTPS link get a browser security warning instead of the redirect.
The posts below show how to request Let's Encrypt SSL certificates. Request one for the new domain and make sure the old domain still has a working one.
- How to request Let's Encrypt SSL certificates with Nginx
- How to request Let's Encrypt SSL certificates with Apache
The server block for your current website also needs updating. Open that server block file and replace every instance of the current domain name with the new one, including the certificate paths if they contain the domain. Save the file when you are done.
The server block for the current site is the one that serves your WordPress files. Edit that one, not the redirect blocks shown above. Don't reload the web server yet. Do the database changes first so the site is not left half-switched.
Update WordPress database
Updating your WordPress database replaces every instance of your old web address with your new domain name so links and images do not break. You do this by running SQL commands that swap the old URL for the new one. Make sure you have a fresh database backup before you start.
The commands below assume the default wp_ table prefix. If your installation uses a different prefix, the table names will start with that prefix instead, so adjust them to match.
- Sign on to your MySQL server from the command line with the command below.
sudo mysql -u root -p
- Type your password and press Enter to log on. If your account has no password, just press Enter. You should see the MySQL prompt.
- Change to your WordPress database with the command below. MySQL should confirm that the database changed.
use wpdatabase;
- 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. Note the old address shown for the home and siteurl options, since these are the values you are about to change:
+-------------+------------------------------------+ | option_name | option_value | +-------------+------------------------------------+ | home | https://geekrewind.com | | siteurl | https://websiteforstudeents.com | +-------------+------------------------------------+ 2 rows in set (0.00 sec)
- Run the commands below to update the values for the home and site options. MySQL should report the number of rows changed.
If your WordPress configuration file sets the site address directly, that value overrides the database. Update it there as well.
UPDATE wp_posts SET guid = replace(guid, 'https://geekrewind.com','https://geekrewind.com');
- Run the commands below to update the post_content value in the wp_posts table. This fixes the links and image addresses inside your posts and pages.
UPDATE wp_posts SET post_content = replace(post_content, 'https://geekrewind.com', 'https://geekrewind.com');
- Run the commands below to update the meta_value value in the wp_postmeta table. This covers addresses stored by themes and plugins, such as featured image and page builder data.
One caution: some plugins and themes store addresses inside serialized data, where the text length is saved along with the text. A plain SQL replace can break those entries because the new domain has a different length. If a widget, theme setting, or page builder layout looks wrong afterwards, restore your backup and use a search-replace tool that handles serialized data instead.
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'https://geekrewind.com', 'https://geekrewind.com');
- Exit the database console. You should be back at your normal shell prompt.
Double-check your work
Double-checking your work ensures your site loads correctly on the new address and helps you catch broken links before your visitors do. Test your main pages, log in to the dashboard, and then restart your web server to finish the migration.
Work through this checklist:
- Open the new domain in your browser. The home page should load over HTTPS with no certificate warning.
- Click through several posts and pages and check that images and internal links point to the new domain.
- Log in to the WordPress dashboard on the new domain and confirm that the address shown under Settings General is the new one.
- Open the old domain, with and without WWW, and confirm that each redirects to the matching page on the new domain.
If you use Google Search Console, add the new domain there and use its change of address option for the old one. Also update any addresses saved outside WordPress, such as email signatures, social profiles, and payment or analytics settings.
If everything is working, restart Nginx or Apache so it picks up the new configuration. Test the configuration for errors first, because a typo in a server block can stop the web server from starting. If something goes wrong, restore your backup and the previous configuration file, then try again.
That should do it!
Conclusion:
- Changing a domain name in WordPress involves several crucial steps to ensure a smooth transition. Back up your files and database before you start.
- Register a new domain name and update DNS records to point to the current server host IP.
- If applicable, create a new virtual host or server block to handle the new domain, redirect the old domain permanently, and ensure SSL certificate configurations are in place for both.
- Update the WordPress database to replace all instances of the old domain with the new one, and watch for serialized data.
- 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 is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.
No comments yet — be the first to share your thoughts!