Skip to content
Home » WordPress » How to Change HTTP into HTTPS in WordPress

How to Change HTTP into HTTPS in WordPress

Change HTTP into HTTPS

After configuring SSL settings of the web server, now here comes a question: how can we change all HTTP URL into HTTPS URL ones in our WordPress site?

I know there're many plugins can do this, but mine is very quick and straightforward as long as you are able to connect to your MySQL database and issue UPDATE statements. No need to install any plugin.

There're at least 8 columns need to be replaced. Please backup your database before doing this.

update wp_blog_commentmeta set meta_value = replace(meta_value,'',''); update wp_blog_comments set comment_content = replace(comment_content,'',''); update wp_blog_options set option_value = replace(option_value,'',''); update wp_blog_postmeta set meta_value = replace(meta_value,'',''); update wp_blog_posts set post_content = replace(post_content,'',''); update wp_blog_posts set guid = replace(guid,'',''); update wp_blog_posts set pinged = replace(pinged,'',''); update wp_blog_termmeta set meta_value = replace(meta_value,'','');

The key of the solution is to use MySQL REPLACE() function to change all occurrences of the column and then use the new content to update itself.

Please note that, wp_blog_ is the table prefix and is the domain name, please replace them with yours.

Since I use Redirection plugin for managing old permalinks, so I also changed some data on its table.

update wp_blog_redirection_items set action_data = replace(action_data,'', '');

There're could some content created by other plugins needed to be replaced with, you can do it in the same way.

If everything goes well, you can redirect all incoming visits to HTTPS.

Leave a Reply

Your email address will not be published. Required fields are marked *