I get this question a lot. “I moved my WordPress site from another host and now it’s redirecting to the old domain. What’s the problem?” Even though you change your domain name in the configuration file, references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.
If you move your WordPress site or change your domain name, you have to change it in several places, not just the WordPress configuration file (wp-config.php). WordPress stores your domain name in multiple database tables as well. So you need to find all references to the old domain name and replace them with the new domain.
Here’s a list of simple steps to fix the redirect problem:
- Export your database to an SQL file using phpMyAdmin or some other database management tool. Make sure you select an option to “drop table if exists,” otherwise you’ll get errors when trying to re-import your SQL file.
- Open the SQL file in your favorite text editor and replace all instances of “http://old_domain.com” with “http://new_domain.com” in the entire document using the Find and Replace tool. I use Notepad++. It’s a great text editor and it’s free.
- Save your changes and close the file.
- Import the eidted SQL file using phpMyAdmin tool or some other database management tool.
- And finally, edit wp-config.php replacing the old domain with the new domain.
That it! Your redirect problem should be fixed.