How to migrate a HTTPS WordPress installation to localhost?

I’ve migrated a site from a live server to a localhost using the WP Migrate DB plugin. I’ve done this process a couple of times before and it’s all been fine. This time however I’ve migrated a site from an https: connection and I can’t get into the site on my localhost. It gives me the following error:

This site can’t provide a secure connection

localhost sent an invalid response.
ERR_SSL_PROTOCOL_ERROR

I’m guessing that in the back end of WordPress I need to change something either in the database, or in the Dashboard > Settings > General tab.

At the moment I can’t get into the site though, so I would think i’ll have to do it via the database?

Any help or assistance would be awesome. I don’t quite know where to start.

Paul.

5 s
5

This is because the site_url and homeurl of your original installation are set to HTTPS in the database, so you can’t access your website on localhost unless you:

  1. Change these values to non-ssl
  2. Install a SSL certificate on localhost

I will only explain the first case since installing a certificate is out of this community’s scope.

To do this, you have 2 options.

Directly edit the downloaded SQL file

Open the MySQL export that you just downloaded from your server. Search for wp_options and you will find a line in your database like this:

INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES

The 2 lines below this one are siteurl and homeurl. Change both of their values to http://localhost/. Pay attention to quotes and commas! So, the 3 first line will look like this:

INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES
(1, 'siteurl', 'http://localhost/', 'yes'),
(2, 'home', 'http://localhost', 'yes'),

Then upload your SQL file. That’s it.

Update the values by PHPMyAdmin

If you have PHPMyAdmin installed on your localhost, or you have enough knowledge to directly update the tables via command line, the proceed with this method.

Login to your database by PHPMyAdmin. From the left navigation menu, choose the proper database. Now, select the wp_options table from the right section.

Again, the two beginning values will be siteurl and homeurl, which you can simply update to http://localhost/ without worrying about making a mistake by editing the original SQL file.

Leave a Comment