Do you want to fix the issue of redirecting to an old domain?
When you migrate a WordPress website to a new domain, there is a possibility that users will be redirected back to the old domain.
In this article, we will show you how to fix WordPress redirecting to an old domain after migration.
What Causes Redirection to Old Domain After Migration Issue?
When you’re moving your WordPress website to a new domain, it is important to set up redirection. This way, users automatically land on the new location, and you get to keep your keyword rankings and traffic.
However, redirection to a new domain may not work properly, and your visitors would be redirected back to the old domain.
One of the main causes for this issue is that your site URL and home URL values are different in the WordPress database tables. You need to make sure that both these values lead to your new domain.
Besides that, DNS issues can also cause users to redirect to the old domain after migration. If the DNS server is not responding or DNS records haven’t been updated, then your visitors won’t be able to view your new website URL.
That said, let’s see how you can fix WordPress redirecting to the old domain after migration. We will cover different methods, so you can click the links below to jump ahead to your preferred section.
Method 1: Update the Site Address in WordPress Settings
The easiest way to fix this issue is by ensuring that the WordPress address and site address is the same in your WordPress settings.
If your Site Address (URL) still shows the old domain, then users will be redirected to the previous URL after migration.
To fix this, simply head to Settings » General from your WordPress admin panel. After that, enter your new domain under the ‘Site Address (URL)’ field.
Once you’re done, save your changes and visit the new domain to see if the problem is resolved.
If, however, the URL fields are greyed out and won’t let you type a new address, continue reading and use one of the other methods to redirect your domain.
Method 2: Changing Site URL in WordPress Database
Another method of fixing the redirecting to the old domain issue is by updating the site URL in the WordPress database tables.
You can easily access the database using the cPanel provided by the WordPress hosting service.
For this tutorial, we will be using Bluehost as an example, but the process is similar for other hosting companies like Hostinger, SiteGround, etc.
First, you’ll need to log in to the hosting service control panel. After that, you can go to the Websites tab from the left menu. From here, simply click the ‘Settings’ option for your website.
Next, you will see details of your website and different settings.
You can scroll down to the Quick Links section and click the ‘phpMyAdmin’ option.
After that, you will need to wait for a few seconds until phpMyAdmin opens.
Once it opens, you must go to the wp_options table from the navigational panel on your left.
Do note that each hosting service has a different naming convention for database tables. However, the one you’re looking for will always end in ‘_options.”
For example, in this tutorial, we will click the ‘staging_45f_options’ table in Bluehost’s phpMyAdmin.
Next, you will need to edit the ‘siteurl’ and ‘home’ options.
First, go ahead and click the ‘Edit’ button for ‘siteurl’ option.
After that, you will need to enter the new domain name in the option_value field. Once that’s done, simply click the ‘Go’ button.
Now, you can return to the main wp_options page and edit the ‘home’ option.
Next, you will need to enter the new domain in the option_value field.
After entering the value, click the ‘Go’ button.
Method 3: Flush DNS Cache on Your PC
If you’re still unable to resolve the issue of the old domain redirecting after migration, then you should check the DNS settings.
At times, it can take up to 12 to 48 hours for the change of domain name to take effect. As a result, internet providers that don’t have updated DNS records will redirect users to the old domain.
You simply flush the DNS cache so that it gets the latest information and the new website URL. This also helps resolve the DNS server not responding issue.
For more details, please see our guide on how to clear your DNS cache on Mac, Windows, and Google Chrome.
Pro Tip: Use SEO Plugin to Perform Full Site Redirect
When you manually perform redirection to a new domain, there is always a chance of errors. As a result, users would still be redirected to the old domain.
An easier way of setting up redirection is by using a WordPress SEO plugin like All in One SEO (AIOSEO). It offers a powerful redirection manager that you can use to redirect your entire site to a new domain without any issues.
This tool was built by our team, and it is what we use when we’re migrating websites to a new domain or merging two sites into one. You can learn more by following our step-by-step guide on how to properly do a full site redirect in WordPress.
Additional Resources for Moving Your Site
- 8 Best WordPress Migration Services (Compared)
- How to Migrate Google Business Profile Website to WordPress
- 9 Best WordPress Migration Plugins (Compared)
- Ultimate WordPress Migration Guide for Beginners (Step by Step)
- Ultimate Website Migration Checklist: 16 Steps You Need to Do
We hope that this article helped you learn how to fix WordPress redirecting to an old domain after migration. You may also want to see our guide on the most common WordPress errors and how to fix them and our expert picks for the must-have WordPress plugins for business sites.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
THANKGOD JONATHAN
I have once had a wordpress site with a different domain and now want to migrate it to my new domain. Please how do I do redirects so that people who visit oldsite.com/page1 to land in newsite.com/page1?
WPBeginner Support
For that you would want to take a look at our article below:
https://www.wpbeginner.com/wp-tutorials/how-to-properly-move-wordpress-to-a-new-domain-without-losing-seo/
Admin
Moinuddin Waheed
This is very common issue when migration to a new domain or new server.
The url redirects to the old domain name and it keeps doing so.
I think using AIOSEO and doing full site redirects audit will give the exact reasons for redirect and we can resolve this easily.
Johan
Very clear, but doesn’t work for me. I copied a backup from the host to my localhost. Changed everything I could find to the localhost, but it keeps redirecting me to the live website. WP Admin does work locally, it’s just the website.
Am I missing something?
WPBeginner Support
Your site likely still has the old domain in the local settings, we would recommend taking a look at our article below for the transfer steps we recommend
https://www.wpbeginner.com/wp-tutorials/how-to-move-live-wordpress-site-to-local-server/
Admin
Johan
I did change the local settings, but the link was somewhat interesting.
It seemed to be a problem with 2 things: Chrome and DNS. I flushed the DNS and tried Firefox, then it worked like it should. After cleaning up Chrome it worked too.
Apparently, no matter what you do, there is always some trace left on the machine rather than WordPress or the database.