0

I've followed all the steps for migrating my existing wordpress site to another server. However, when I try to login to the migrated site, it keeps redirecting me to the old one, despite whether I use wp-admin.php or wp-login.php.

I have also read about a dozen different pages on migrating worpress accounts, but not one of them encounters the problems I am having with some of the steps.

These are the steps I have followed, including differences I am encountering with those specified on migration instructions (problems highlighted in bold):

1) Downloaded all wordpress files from oldsite to my hard drive using ftp.

2) Downloaded the database from my oldsite using PHP myadmin.

3) Uploaded all the wordpress files to a chosen directory on my newsite using ftp.

4) Created a new database on the newsite using PHP Myadmin. As I am loading onto a different server, I created a new database using the same database name and password from the oldsite. That way I didn't have to change the WPconfig file. Is that okay to do? Not a single migration article I read used the same database and password, nor did they say not to, so I assumed it would be okay.

5) Used phpMyadmin to change the database entry in wp_options to the new URL. However, every instruction I read says there are two fields to change: siteurl and home. There is no home field in my wp-options. Just siteurl.

6) I used the following string entered into SQL in phpMyadmin to change all the oldsite urls to the newsite url successfully:

update wp_posts set post_content = replace( post_content, 'http://oldsite/', 'http://newsite/');

Did the same for all these database tables:

wp_posts wp_redirection_logs wp_users wp_redirection_items

I checked each table and all of the changes were fine.

7) Checked every database table to make sure there were no instances of the oldsite URL. Could not find one.

8)Entered newsite URL into browser. I get a 404 message. The menu, latest postings and banner all appear okay, but if I hover over any of them they are all pointing to the oldsite URLs.

9)When I try to get into the admin panel of the newsite, it allows me to enter the name and password, then automatically redirects me to the oldsite and asks me to login again. Tried on different browsers but the results are always the same.

Any ideas what I'm doing wrong?

0

Try to add the following two lines in wp-config.php file:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
  • 1
    While this does work. It's better to make sure there are no wrong entries in your database and that all links to the old site are adjusted. – rudtek Mar 13 '17 at 5:07
  • The two lines suggested by the last poster worked well. I can now access the new site via admin. The only issues I am seeing now is that the menu bar is still being served up from the old site. Perhaps I missed a URL in the database somewhere. Or maybe my messing around with the newsite altered the database again as soon as I used a link. As I haven't yet deleted the oldsite, Wordpress Admin claims the newsite is in safe mode. However when I try to confirm WP to remain in safemode it comes up with an error saying something went wrong (without saying what). Is it in safemode I wonder? – smashingtuck Mar 14 '17 at 0:32
  • Yes , It is safemode. – ferdouswp Mar 14 '17 at 8:42
1

First make sure that your wp-config file you've got is connected to the right database.

You need to go into your new database and change the site url and home url (this is definitely your missing issue here) to the new address. I suggest not doing this through phpmyadmin though as it will cause some problems.

Go get this tool: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Upload it into your www/ folder. (I usually rename the search and replace folder to SRDB.)

now navigate to your site with the SRDB at the end. (www.example.com/SRDB)and the top two lines you'll see a search field and a replace field. (if you get a db connection error here, double check the wp-config to ensure that it has the right credentials). In the search place your old site address

in the replace field place your new url

hit live live run.

ONLY do this after ensuring you're on your new url and that it's loaded into your new database.

This should fix your problems!

In the future there will have to be no phpmyadmin searches either when you use this tool.

  • 1
    There is no 'home' field in the wp_options database. There is only 'siteurl'. I will happily post the contents of the wp-options table up here (with sensitive data removed). – smashingtuck Mar 13 '17 at 17:54
  • try uploading the content of the original database from the old site into the new phpmy admin and then run the script as I outlined above. – rudtek Mar 13 '17 at 17:58
  • Can you elaborate as to why not change this through phpmyadmin? What problems does it cause? – bart Sep 26 '17 at 18:18
  • Depends on how thorough you make the changes. did you change all incidences of code within serialized PHP strings (themes, css, user info etc)? did you change all your attachment references? Did you ensure there are no references left that will leave a 404 error when you take the old site down? If you don’t, then settings will go missing, fields will get corrupted, pictures won't load, themes break and your site runs a severe chance of not working on the new location or running slowly. Why worry about that when you can use a tool that takes care of it quickly and efficiently? – rudtek Sep 26 '17 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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