How to Change Your Domain Name in WordPress: A Step-by-Step Guide
Bulletproof Backups for Your WordPress Website
Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.
Changing your WordPress website’s domain name can be scary. You might want to do this if you have a better name or want to rebrand your site. But it’s not easy. Especially if you are migrating your site to another host as well.
What if your links stop working? What if people can’t find your site anymore? What if you lose visitors? These are big worries for website owners. You might think it’s too technical or too risky to change your site’s name.
Don’t worry! We’re here to help. This article will show you how to change your WordPress website’s name without all the stress. We’ll teach you how to:
Your website will keep getting visitors, just like before. With our step-by-step guide, you can change your site’s name without all the headaches.
TL;DR: Changing your WordPress site’s domain name is a step-by-step process. First, backup your site, buy a new domain, and update DNS settings. Then adjust your WordPress configuration and set up redirects. This way, you can switch your domain while keeping your content and SEO intact.
Now that you know changing your WordPress website’s name is possible, let’s get into the details. This guide will focus on only changing your website’s name.
We’ll walk you through each step, explaining what to do and why.If you do need to move your whole site to a new host, that’s a bit different. We recommend using plugins to migrate your WordPress site.
Step 1: Getting ready to change your domain name
To make sure changing your WordPress site’s domain is smooth, it’s essential to prepare.
Backup your WordPress website
Before making any changes, backup your entire WordPress site. Imagine spending hours on a project only for it to disappear due to a glitch. Losing your website data is as frustrating.
Use BlogVault to create a backup of your site, including your files and database. If anything goes wrong, you can restore your site in minutes.
Buy a new domain
You need to buy a new domain name from a domain registrar like GoDaddy, Namecheap, or Google Domains. It is always good practice to make sure the new domain name reflects your website’s purpose. Bonus: it is easy to remember.
Verify domain ownership
Once you’ve purchased the new domain, you must verify your ownership. Usually, the domain registrar will send you an email with instructions for doing this.
Changing nameservers to point to your site
Nameservers change domain names into IP addresses. When someone types in www.yoursite.com, the nameserver finds the IP address for your website. This step is a little technical, but it is a one-time task.
To change the nameservers:
- Get the new nameservers provided by your web hosting provider. These are usually in the format of `ns1.example.com` and `ns2.example.com`.
- Log into your domain registrar account. Find your new domain.
- Find the option to manage DNS settings or nameservers for the domain. You might see default or existing nameservers. Update them with the ones you got from your hosting provider.
- Save the changes. Domain propagation takes up to 48 hours, so be patient.
Note: You might need to log into your hosting account to ensure the new domain points to your WordPress site. This step depends on the web host, but generally involves changing a setting in the dashboard. Hosts like WP Engine, Bluehost, and Cloudways, have documentation to guide you.
Step 2: Changing your domain on your site
Here’s where things get a little technical. In this section, we change the domain on your WordPress site. This makes the domain name change official.
Option 1: Update the URL in WordPress Settings
- Log into your WordPress admin dashboard (usually yoursite.com/wp-admin).
- Go to Settings > General.
- In the fields labelled WordPress Address (URL) and Site Address (URL), enter your new domain name. Make sure it includes http:// or https:// at the beginning and does not have a trailing slash. For example: http://newdomain.com.
- Scroll down and click Save Changes.
Once you update and save these settings, you may need to re-login.
Option 2: Editing wp-config.php (not recommended)
Editing the wp-config.php file can change the domain, but it’s not recommended. There is a huge risk of site errors, and this method makes the General options unavailable.
- Access your hosting account file manager or use an FTP client to locate your wp-config.php file.
- Add or edit the lines:
define('WP_HOME','http://newdomain.com');
define('WP_SITEURL','http://newdomain.com'); - Save the file and upload it back to your server.
Option 3: Changing domain via phpMyAdmin
For specific WordPress setups, like multisite installations, this method might be necessary.
- Log into phpMyAdmin. You can do this via cPanel, or from your browser.
- Select your WordPress database. Locate and click on the wp_options table.
Find the siteurl and home rows. Edit these values to your new domain. Save the changes.
Step 3: Updating internal links
Once you’ve changed your domain, it’s important to update all internal links and media URLs. There are a few ways to do this.
Option 1: Using a plugin
You can use a plugin like Better Search Replace to make this process simple. This plugin automates the process, making it easy even if you’re not tech-savvy.
- Install the plugin: Go to your WordPress dashboard, and navigate to Plugins > Add New. Search for Better Search Replace, and activate it.
- Configure settings: Go to Tools > Better Search Replace. Here, you’ll enter your old and new domain names.
- Dry run: Before running the operation, try a dry run. If there are any issues, you can resolve them.
- Update URLs: Run the plugin to update all internal links and media URLs.
Some alternative plugins to try are Velvet Blues Update URLs or Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More.
Option 2: Via WP-CLI
If you’re comfortable using WP-CLI, you can run the following command:
wp search-replace 'current-domain.com' 'new-domain.com'
This command will scan your entire site and replace all instances of the old domain with the new one.
Option 3: Manual link updates via the database
If you like having more control, you can update the URLs in the database. As you can imagine, we discourage this method. There is great potential for human errors, which leads to site errors.
- Access your database: Log in to your web hosting control panel. Locate and click on phpMyAdmin, or whichever management system your site uses.
- Open your site database: Select the database that your WordPress site uses.
- Run the SQL query: Click on the SQL tab at the top of the screen. Enter the following SQL query to search for and replace the old URL with the new URL:
UPDATE wp_posts SET post_content = replace(post_content, 'http://old-domain.com', 'http://new-domain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://old-domain.com','http://new-domain.com');
Note: Replace wp_ with your actual table prefix. The above query assumes the default wp_ prefix is in use. - Execute the query: Click Go to run the query.
Note: This is not the same as updating the domain name, like in the previous step. Here, you are running an SQL query to search and replace old URLs with new ones.
Step 4: Configuring 301 redirects
Setting up 301 redirects is how to ensure your visitors and search engines find your new content.
Option 1: Setting up redirects in .htaccess
- Use an FTP client or your hosting control panel to locate your site’s .htaccess file. As it is a hidden file, you will have to enable this setting in your client to see the file.
- Open .htaccess with a text editor.
- Add the following code to redirect visitors from the old domain to the new domain:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L] - Save the changes and upload the .htaccess file back to your server.
Option 2: Using Plugins for 301 redirects
If your site doesn’t have an .htaccess file, then you can use a plugin instead. There are several plugins that can handle redirects for your site. We’ll be using Redirection in this tutorial, but there are other options. Even SEO plugins like Yoast or Rankmath have redirection features.
- Install a redirection plugin. Go to your WordPress dashboard, navigate to Plugins > Add New. Search for Redirection, and install it. Activate the plugin.
- Configure the redirections. Go to Tools > Redirection. Follow the setup wizard or add new redirects manually. For each old page URL, input the corresponding new page URL. For example, old-website.com/old-page redirects to new-website.com/new-page.
- Test out the redirects. Visiting old URLs in your browser to verify they point to the new ones you’ve set up.
301 redirects maintain traffic flow and SEO rankings from the old to new domain. They make the transition much smoother.
Step 5: Caches and checks
You’ve changed the domain on your WordPress site. Now, let’s make sure everything is working as it should.
Checking for broken links
Broken links can frustrate your visitors. Use tools to ensure all links are intact, while saving your time.
- Use an online tool: Websites like BrokenLinkCheck.com scan your site for broken links and help you fix them.
- Plugins for scanning links: Plugins like Broken Link Checker for WordPress can detect and notify you of any dead links.
Clear all caches
After making site changes, clear your site’s caches. This ensures visitors see the latest version of your site.
Testing the new domain
Once you’ve updated the nameservers, the changes won’t be immediate. It can take up to 24-48 hours for the DNS changes to propagate worldwide. Occasionally it happens faster, but you may have to wait.
After a day or so, use online tools like whois.net or whatsmydns.net to check if the nameservers have changed. These tools will show you the current status of your DNS settings globally.
Step 6: Informing search engines and updating SEO
Now it’s time to let search engines know about the domain change. These steps maintain your search rankings and ensure traffic doesn’t drop.
Submitting new domain to Google Search Console
Once your new domain is live, you need to add it to Google Search Console. If you don’t already use Google Search Console, this is a good opportunity to start. It is like a communication tool with Google.
- Sign in and add your new domain.
- Google will ask you to verify that you own the new domain. You can do this by adding a TXT record to your DNS settings or by uploading an HTML file to your WordPress website.
Notifying other search engines
Google isn’t the only search engine you may need to consider. You can also notify Bing and other search engines about your new domain. Check where your traffic comes from to establish whether you need to do this.
Updating XML sitemaps
Your XML sitemap is a roadmap for search engines. Updating it ensures that search engines understand the structure of your new site.
- Generate a new XML sitemap. Plugins like Yoast SEO or Google XML Sitemaps can help you create an updated sitemap.
- Go back to Google Search Console and submit your new sitemap under the Sitemaps section.
Troubleshooting
Changing the domain on your WordPress site can sometimes come with a few bumps in the road. Here’s a guide to help you troubleshoot common issues, ensuring a smooth transition.
Site crashed
There are a few reasons why a site could stop working after changing the WordPress domain name.
If your site crashes, you can temporarily fix it by accessing it through FTP. Edit the functions.php file to regain access.
Domain not propagating
DNS propagation can take up to 48 hours. Be patient, and in the meantime, check your nameserver settings to ensure they’re correct. Sometimes, it just takes a bit of time for the changes to spread worldwide.
Should you even switch to a new domain?
There could be several reasons behind the desire to migrate WordPress site to new domain.
Conclusion
Lots of businesses change their website names, so don’t worry. With this guide, you can do it too. Always start by backing up your site. Use a reliable tool like BlogVault. Take your time, follow each step, and soon your site will have its new name up and running.
If you get stuck, don’t worry. You can always restore a backup and start over. The most important thing is to keep your site working well for your customers.
FAQs
What is the proper way to change domain name?
The proper way is to buy a new domain, back up your site, update DNS settings, and set up redirects from the old domain to the new one.
Can I transfer, change or replace my WordPress domain?
Yes, you can change your WordPress domain. Buy a new domain first. Then update your site URL in WordPress settings and your hosting configuration. Finally change all the links on your website to reflect the new domain name.
How do you change the domain name on the same host?
Add the new domain to your hosting account, update your site’s files to use the new domain, and set up redirects from the old domain.
How do I change the URL name in WordPress?
Go to Settings > General in your WordPress dashboard and update both the WordPress Address and Site Address fields with your new URL.
What is the easiest and best way to transfer a WordPress site to a new domain?
Use a migration plugin like Migrate Guru or All-in-One WP Migration. These tools automate much of the process, making it easier and reducing the chance of errors.
Tags:
Share it:
You may also like
Fix: WordPress 403 Forbidden
Stuck with a “403 Forbidden” error while trying to access your WordPress site? It’s a little scary and quite cumbersome but you can troubleshoot WordPress errors like this. It’s a…
7 Easy Ways To Fix WordPress Database Error Disk Full
You’re all set to install a new plugin or publish an important post on your WordPress site, only to be stopped by an error saying your disk storage is full. …
Fix: WordPress 413 Request Entity Too Large
Fixing errors in WordPress site is like hitting a digital roadblock. It can be frustrating and disruptive. But, you’re also left wondering why this is happening to you. The “413…
How do you update and backup your website?
Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.
Updating Everything Manually?
But it’s too time consuming, complicated and stops you from achieving your full potential. You don’t want to put your business at risk with inefficient management.
Backup Your WordPress Site
Install the plugin on your website, let it sync and you’re done. Get automated, scheduled backups for your critical site data, and make sure your website never experiences downtime again.