How to fix https broken WordPress site via SSH

This guide will help if you have a broken WordPress site because of changing http to https in the WordPress administration page. In other words you or somebody has changed the WordPress URL to HTTPS and now the WordPress website is broken.

In this guide, we will fix this issue by using SSH access and terminal access to the Mysql database. The chance is there that the engine you will be using is the MariaDB engine. The commands provided will also work with the MariaDB engine.

First of all, download putty or any other ssh client and make sure that you have SSH access to your server that is running the WordPress database.

Once you have logged in at your WordPress database, you will need to run the following commands:

SHOW COLUMNS FROM wp_options;
SELECT option_id,option_name,option_value FROM [YourDatabaseName].wp_options where option_name like '%siteurl%';
SELECT option_id,option_name,option_value FROM [YourDatabaseName].wp_options where option_name like '%home%';

You will get a response showing the option_id, option_name and option_value.

The following commands will update those values to correct values (Make sure that the option_id matches the option_id shown in the select command.):

UPDATE `wp_options` SET `option_value` = 'http://yourwebsite.com' WHERE `wp_options`.`option_id` = 1;
UPDATE `wp_options` SET `option_value` = 'http:// yourwebsite.com' ' WHERE `wp_options`.`option_id` = 33;

Now you can exit the database, and visit your site via http://.

Navigate to the WordPress configuration page and verify that the config is indeed http:// and not https://.

Share This Message