8

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?

1

8 Answers 8

22

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:

define('WP_HOME', 'http://your_server/blog');
define('WP_SITEURL', 'http://your_server/blog');

Note that in most cases, WP_HOME and WP_SITEURL will be the same, apart from exceptional circumstances.

4
  • 1
    I checked the above two steps... but even after when i load my url for the first time it takes me to the oldserver and when i load at second time it stays in new server.. is this a landing page sort or problem...
    – balanv
    Apr 2, 2011 at 4:50
  • 2
    only my home page gets redirected.. all other pages are fine...
    – balanv
    Apr 2, 2011 at 6:21
  • This step seems to be getting overridden for me.
    – landed
    May 17, 2017 at 8:08
  • In my case, I actually was using the old database name in wp-config.php. This answer had me open wp-config and find the evidence of my negligence. Thanks!
    – Jason
    Jan 28, 2022 at 16:56
3

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.

2
  • What was the issue and what did you do to fix it? Apr 4, 2011 at 14:02
  • While copying the content from old to new server.. the landing page is set for old server got copied to newserver too.. so it resulted in redirection.. i removed the landing page, and the problem is cleared..!!
    – balanv
    Apr 5, 2011 at 10:39
1

If using HTTPS change the value for wordpress-https_ssl_host in the wp_options table.

1

The above answer didn't work for me. See https://wordpress.stackexchange.com/a/179788/107311 by James

change "siteurl" and "home" in the database table "wp_options" (through phpMyAdmin or similar)

1

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.

1

Here’s a checklist

  1. Search and Replace domain in database
  2. Update wp-config.php with new domain
  3. Check DNS propagation
  4. Clear your cache and disable caching plugins
  5. Check web server to see if there are any server level redirects.
  6. Disable All Plugins while testing and apply default theme.

If it still doesn’t work then please provide details of your web server hosting setup and platform.

0

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.

define( 'WP_HOME',    'http://your_server/your_blog_url' );
define( 'WP_SITEURL', 'http://your_server/your_wordpress_url' );

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

select * from wp_options limit 2

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.

0

If you did all the changes listed in this thread, try with incognito mode.

If it works in anonymous/incognito mode, check your wordpress USERS table and migrate the profiles to your new URL (user_url field).

Hope it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.