I had recently moved my wp site from a domain to other, but when I type in the new domain’s address it gets redirected to the old domain/some_page.
Is this any common problem? Is there any known solution to this?
I had checked my code and it has no redirects to this page. Can someone give me a hand on this?
This is because the URL settings inside WordPress are still pointing to the old WordPress site. More information is available in the Moving WordPress documentation.
If your WordPress admin pages are still working, you can go to Settings â General, and change the WordPress URL and the Site Address to the correct values.
If your WordPress site is completely broken, then you can add the following values to
wp-config.php
, which will have the same effect:Note that in most cases, WP_HOME and WP_SITEURL will be the same, apart from exceptional circumstances.
Give DNS 12-24 hours to propogate and flush the DNS cache on your PC.
Check
wp-config.php
for hardcoded URLs and change them, if needed.Search your database with phpmyadmin for all occurrences of the old URL using interconnectit.com WordPress Serialized PHP Search Replace Tool.
Reset Dashboard>>Settings>>Permalinks and be sure .htaccess is writable.
Check your theme files for hardcoded URLs.
If using HTTPS change the value for
wordpress-https_ssl_host
in thewp_options
table.The above answer didn’t work for me. See https://wordpress.stackexchange.com/a/179788/107311 by James
Export the database (in .sql) and search for the domain it is redirecting to.
If you don’t see it maybe it’s a (mu-)plugin that has old url hard coded.
In some instances it the browser could cache the redirect so try accessing the site with private/incognito window/tab.
Hereâs a checklist
If it still doesnât work then please provide details of your web server hosting setup and platform.
If adding the bellow is not working but only for the default directory in word press, congrats there should be no problem. You have a cache problem (if you don’t care for the reason just skip to the bottom), which you cant use the normal refresh to fix. The reason is as soon as you go the the url you get redirected to a new url and then when you refresh you actualy refresh the new url not the old cache, so the fastest fix it is just to clear the cache & history.
special note: if you look in the wp_options table the first 2 entries also reference to the perm link
fast command to find it bellow
Just try clearing your browser cache & history, alternatively just open it in a browser you don’t use much. If it works its a cache problem.