Domain migration is the process of moving an entire website from one domain to another. People do it for various reasons, like rebranding, acquiring a new domain name, cloning a website, or improving the website’s performance.
But most of the new users are seen to commit a common mistake during a website migration. They forget to redirect the old domain to the new domain. As a result, whenever they try to access any new content, they land in the old domain.
Months ago, we covered a blog post on how to clone a WordPress site. Today, we’ll show you how to redirect an old domain to a new domain after cloning or migrating a site. Ready, set, go!
What Causes WordPress Redirecting to Old Domain After Site Cloning and Migration
There are several common mistakes that usually take place during cloning and migrating a WordPress that result in redirection not being executed successfully. We have listed those causes below with a brief discussion.
a. Improper Configuration of Redirects
Failing to configure the redirects correctly to the new domain is a key reason why your site may redirect to the old domain after cloning and migration. So, when a website is moved to a new domain, it’s important to update the necessary settings.
b. Failure to Update Internal Links and References
You should update internal links and references to reflect the new domain. Otherwise, there might be many faulty posts and pages that will redirect users to the old domain. You may update these links manually or in bulk using any suitable plugin.
c. Incomplete Migration and Cloning Process
Unless the cloning and migration are carried out properly, some files and database entries may still redirect to the old domain. So, you shouldn’t stop the process for any reason while the migration is running. If it ever gets stuck, it’s best to start the whole process all over again.
d. Issues with Server Configuration
DNS issues and incorrect server settings can often prevent visitors and users from redirecting to the new domain. To resolve this issue, you must check the server configuration and DNS records. Contact your hosting support to know if something happened on their end. Learn what are common WordPress errors and how to fix them.
e. Problems with Sitemap Submission and Reindexing
If search engines like Google and Yahoo haven’t indexed the new domain or the sitemap hasn’t been updated well, users may be redirected to the old domain when they click on search engine results. Request search engines to reindex the website and recognize it as a new domain.
How to Fix WordPress Redirecting to Old Domain after Cloning or Migrating to a New Domain
There are many ways you can fix the problem of WordPress redirecting to an old domain. We’ll show you the easiest methods of them in this section. Keep reading!
Method 01: Update the Site Address in WordPress Settings
Updating the site address in WordPress settings is the easiest way to fix this problem. Go to Settings > General.
Come to the boxes WordPress Address (URL) and Site Address (URL). Type your new domain addresses into these boxes. Hit the Save Changes button at the end.
If, for any reason, you can’t change the WordPress address (URL), try the next method.
Method 02: Change the Site URL in the WordPress Database
Go to your cPanel. Find the click the phpMyAdmin option.
For each domain, there will be a database. As we are maintaining three websites under this cPanle, there are three databases in phpMyAdmin.
Click the plus (+) icon next to the database where your domain is hosted. This will expand the list of options available under the database.
Click the option wpwn_options. You’ll get all the options, and their values appear on the right side. Click the Edit option respectively next to the option names siteurl and home.
Write your domain address in the respective section marked in the image below. Save it.
Hope this will solve your problem.
Method 03: Redirect Your Old Site to Your New Site Using 301 Redirects
The 301 redirect is an HTTP status code by which you can permanently redirect a URL to another one. Whenever users click the old URL, they will be redirected to the new URL. If you fail to fix the problem using the above two methods, you can apply this one.
Go to your cPanel again.
Select the redirect type Permanent (301). Next, select your old domain in the second box.
Come to the Redirects box and type your new domain address in it. Press the Add button at the end to save the changes.
Hope your problem will be solved at this stage.
Method 04: Use a Dedicated Migration Plugin
You’ll find lots of WordPress plugins available to handle the redirect issue. Most of the robust SEO plugins also include this feature. All-in-One SEO and Rank Math SEO are the two of them. We’ll now show you how to fix this problem with the Rank Math SEO plugin.
Install and activate the Rank Math SEO plugin. A setup wizard will come after that. Complete it yourself and come to the dashboard.
Go to Rank Math SEO. Enable the Redirections module. This will bring the Redirections option under Rank Math SEO on the WordPress admin menu bar.
Navigate to Rank Math SEO > Redirections. Click the Add New button. Type your Source URL and select a suitable match type from the dropdown list next to it. Visit this post to learn more about the match type of the Rank Math SEO plugin.
After that, type your Destination URL and select the Redirection Type. For permanent redirect, select the option 301 Permanent Move.
Scroll down the page a bit. Press the button Add Redirection.
Thus, you can securely redirect the posts and pages of your old site to your new domain address after cloning and migration.
Hope your problem is already solved. But if you want to explore another method, we have shown one more method below.
Method 05: Manually Set Up Redirects to New Domain using .htaccess file
Go to your cPanel again. Find and open the File Manager option.
You’ll see the .htaccess file in the public_html folder. Open it with the edit mode.
You have to type a similar code shown in the image below anywhere in the editor. Based on your redirection type and objectives, you may have to write different codes. Visit this post to learn how to write redirection codes on .htaccess file.
Method 06: Flush DNS Cache on Your PC
Even after covering all these methods, you may still face WordPress redirecting to the old domain instead of the new one. It may be because your computer’s DNS cache is still pointing to the old domain. You need to flush the DNS cache on your PC to solve the problem.
# Flush the DNS cache on your Macbook
Open the Terminal Application. Type the code
sudo killall -HUP mDNSResponder in the Terminal Window and press the enter button.
You might be asked to enter your administrator password. After the password is typed, press the Enter button again. The cache will be cleared.
# Flush the DNS cache on your Windows
Open the Command Prompt as an administrator. Type the code
ipconfig /flushdns in the Command Window. Press the enter button after that. The cache will be flushed.
We hope your problem is finally solved and your redirection is hitting the new domain.
FAQ on How to Fix WordPress Redirecting to Old Domain after Cloning or Migrating to a New Domain
For additional support and resources on the topic, we’ll answer some commonly asked questions about the topic usually found online.
Which of the above methods are so easy for non-technical users?
Method 01, 03, and 04 are the easiest methods among the above ones for non-technical users.
Will I lose traffic and ranking due to redirecting the old domain to the new domain?
You may experience a temporary drop in rank and traffic after the migration. But if the redirection is done correctly, the impact will be minimized, and you’ll soon regain the lost traffic.
Can I redirect multiple old domains to a single new domain?
Yes, you can redirect multiple old domains to a single new domain. You can do this by setting up proper redirects using the .htaccess file.
What are the popular and dedicated migration plugins available for redirecting old domains to new domains?
Migrate Guru, Duplicator, and UpdraftPlus Migrator.
Should I submit an XML sitemap to search engines after domain migration?
Yes, you should submit an XML sitemap to search engines after domain migration. By submitting the updated XML sitemap to search engines, you can discover and crawl the new URLs on your new domain.
Hope you have enjoyed this article. We want to mention a few more tips before finishing this post. While setting a redirection, make sure to implement individual 301 redirects from each existing page on the old domain to their corresponding pages on the new domain.
Because this will help you preserve the SEO value and a seamless user experience. Alongside this, ensure proper URL structure and XML sitemap. This will help search engines crawl your posts and pages properly. Finally, regularly monitor your site performance in the Search Console and Web Masters.