Migrated site redirects to localhost after successful login

I have copied a site to a non-public demo server to make some edits.

I transferred the files and the database (having disabled permalinks beforehand), updated wp-config.php with the new database info, and ran a PHP script to replace the old URL with the new one in the database.

Read More

The index page loads fine (except for a few missing photos) but every single link results in a DNS error and a successful login redirects to a non-existent localhost folder.

I’m not sure what version of WordPress/plugins/themes as I cannot login. My site can be found at http://iamshawnrice.com/demo/casestudies/

Any ideas are greatly appreciated.

Related posts

Leave a Reply

3 comments

  1. All of your links in the menu are pointing to http://www.magnetmediafilmsinc.com/ which may indicate the search and replace script you used didn’t do the search and replace properly/completely. The other links on the index page are pointing to http://iamshawnrce.com/demo/casestudies/?p=postID which I would expect to see.

    Plugins and caches can also cause this problem. Make sure you disable any caching plugins prior to migration and if you are using a plugin to modify login behavior (e.g. Peter’s Login Redirection or Theme My Login) disable those too. If you can’t get it, this query will disable all plugins but it’s a bit of the nuclear option…

    UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';

    If nothing is working properly, check your database again and see if the old URL still exists in the wp-options and wp-posts tables and also check wp-options to see if your original server path is present in values. If so, you need to change that either via a Search and Replace plugin or by MySQL query or by dropping the database and reimporting with a more comprehensive search and replace with serialization preservation.

    If you change all of the values in the database properly, the site should move and work again.

  2. I had a similar issue and found that when I replaced the filepaths, I’d included a trailing slash, i.e. localhost/sitename/ instead of just localhost/sitename

    This picked up fewer instances than the correct search. Completely re-doing the search/replace and then re-importing to the database worked for me.

  3. I always run into this problem when I migrate a WordPress installation, what you need to do is once you edit the links into the database and import it into the new server, the first thing is to log in to WordPress admin and re-save the permalinks, after that you need to take a look at your .httaccess file and edit it because it must contain the urlbase of the installation folder in your localhost. something like this:
    RewriteBase /installation-folder/
    RewriteRule . /installation-folder/index.php