Search code examples
phpmysqlwordpressmigrate

WordPress migration is redirecting me to do a new installation of WordPress site


I thought I followed the steps to migrate my WordPress site over to a new host correctly but when I navigate to the new site I am getting redirected to the WordPress installation page. Here was my process:

  • ZIP'ed up all of the files of my old WordPress site
  • Exported the MySQL database
  • Uploaded and unzipped the files on the new host
  • Imported the MySQL database on the new host
  • Changed the database connection information in the wp-config.php
  • Changed the siteurl and home in the database options table

Obviously I am missing something but it is not jumping out at me as to where or what I have overlooked.


Solution

  • At first glance you have done enough it probably should load. Looks like the wp-config is invalid or missing if it's wanting to do a new installation from scratch. Check file permissions and server logs. Use wp cli to try and verify parts. E.g. wp db cli will try and connnect to the DB, so that should fail if the DB connection isn't right (quite a likely cause) and wp shell will give you a PHP console with WP laoded - I find this often prints out useful debugging info if it fails.

    However, am I right in deducing from your "Changed the siteurl and home in the database options table" that you migrated not only to a new host, but a different domain as well? In that case you need to change much more in the DB than just those two settings. WP stores all internal links as absolute URLs for example. I would again use wp-cli. The following command is fairly powerful and wide-ranging, so think through your values, but I use it for this kind of migration:

    wp search-replace 'old.domain.name' 'shiny.new.domain.name' --all-tables
    

    If it's a multi-site installation, there's a constant in wp-config.php for the default domain that needs updating too