• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » MySQL Queries to Change WordPress HTTP to HTTPS

By Abhishek Ghosh September 7, 2014 8:06 am Updated on February 2, 2021

MySQL Queries to Change WordPress HTTP to HTTPS

Advertisement

Here are the required MySQL queries to change WordPress HTTP to HTTPS – including post images and all other contents. This is the right fix. Your site has many small matters like the links in the posts which required to be made HTTPS from HTTP. Changing the setting from Settings > General at WordPress backend expected to change the post, category etc URLs. Working with MySQL will make a fine-tune to make all the old URLs (of the images, links) to HTTPs. If you leave the old non-HTTPS address, that will require 301 redirect to HTTPS. 301 redirect will suck page loading time, you will not get the proper refer in analytic software, SEO will not be optimum.

The reader should read our previous guides – Changing Old WordPress to HTTPS From HTTP, Needed Plugins and Snippets for WordPress HTTPS Setup, Solution for WordPress HTTPS and Feedburner 404, XCache and W3 Total Cache WordPress on High End Setup and How to Export WordPress MySQL Database on Rackspace Deployment.

 

MySQL Queries to Change WordPress HTTP to HTTPS : Why Hardcoding?

 

If you do not change the old posts’ URLs from relative path using some plugin to genuine HTTPS, W3TC Plugin’s Page Enhanced Disk Cache will not work – it will pull the HTTP image URLs from Post content and your SSL/HTTPS will break. SEO expert and public speaker True Tamplin says, “For the sake of SEO, it is better to use Post Images from your own URL instead of a CDN.” Even if you use CDN for Post Images, this the right fix. The reason the W3TC Plugin fails because it pulls the Post data from Database, it ignores any Plugin’s filter function. So, with SSL, these commands are mandatory to know, plus; using this commands, you can change the URLs of any non-SSL content – like a signature at the end of the post which is not inserted by any Plugin.

Advertisement

---

MySQL Queries to Change WordPress HTTP to HTTPS

 

MySQL Queries to Change WordPress HTTP to HTTPS

 

So, we will be using WordPress MySQL database from Command Line, like the guide How to Export WordPress MySQL Database on Rackspace Deployment. SSH to your Database server as root and login to MySQL as Root :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
ssh root@112.153.29.178
# change the IP
mysql -u root -p
# provide mysql root admin's password
# mysql interactive mode
# mysql >
# if you commit error, it will become
# mysql >
         ->
# this is asking values due to your error
# type \c and hit enter to get back to
# mysql >

First, take a backup. This is important. Then,

Vim
1
show databases;

Output :

Vim
1
2
3
4
5
6
7
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| your-wordpress     |
+--------------------+

Select your database :

Vim
1
2
use your-wordpress;
# database changed will be the output

Optionally, see the tables :

Vim
1
show tables;

This command changes all http to https in wp_options :

Vim
1
UPDATE wp_options SET option_value = replace(option_value, 'http://thecustomizewindows.com', 'https://thecustomizewindows.com') WHERE option_name = 'home' OR option_name = 'site url';

Change http://thecustomizewindows.com, https://thecustomizewindows.com. You only need to see for Errors in output. Other two parameters are not needed to observe.

We are changing the POST GUID :

Vim
1
UPDATE wp_posts SET guid = replace(guid, 'http://thecustomizewindows.com','https://thecustomizewindows.com');

Now, this is for Post Content (including images)

Vim
1
UPDATE wp_posts SET post_content = replace(post_content, 'http://thecustomizewindows.com', 'https://thecustomizewindows.com');

You should change the Post Meta Too :

Vim
1
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://thecustomizewindows.com','https://thecustomizewindows.com');

Clear Page Cache, Deactivate Page Cache; deactivate any WordPress Plugin which changes URLs to HTTPS or makes relative. On Chrome Browser’s developer tool’s console, you will see the Post Images are HTTPS now. This method is better than the Search and Replace Plugin. PHPMyAdmin is usually not used in high-end setup for better security. Why you will need PHPMyAdmin, you can see things from Command-Line.

 

Update on Changing WordPress HTTP to HTTPS

 

There are several other things which required to be mentioned as an update. You can update your WordPress site address and admin address from the option under Settings > General.

Open wp-config.php and add the following lines somewhere before where it says “That’s all, stop editing!” :

Vim
1
define('FORCE_SSL_ADMIN', true);

The above will force wp-login to be over SSL. If you are using some reverse proxy infront, then should add this logic on wp-config.php file below the above directive :

Vim
1
2
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

We have guide to install Apache on Ubuntu 18.04 LTS with HTTPS, HSTS, HTTP/2. Also, you may read the optimization tips such as Cache Aware HTTP/2 Server Push, TLS false start for a faster WordPress with HTTPS.

Tagged With mysql replace https:// http:// wordpress , mysql replace http https all base , mysql change to https references , local wordpress installation mysql replace https with http , http to https mysql wordpress , database wordpress change http to https , changer http https wordpress database , change to https wordpress mysql , change http to https wordpress database , change http protocol in phpMyAdmin

This Article Has Been Shared 163 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to MySQL Queries to Change WordPress HTTP to HTTPS

  • Installing WordPress on Free OpenShift PaaS

    Installing WordPress on Free OpenShift PaaS can be a free way for installing self hosted WordPress. This is a long, detailed video to startup using WordPress.

  • How to Use Google Data Highlighter and Other Points

    How to Use Google Data Highlighter has been shown as a detailed guide video to tag a set of webpages who can not relate them by HTML tagging. But it has flaws.

  • WP Enqueue Script For WordPress Themes : Handy Guide

    WP Enqueue Script For WordPress Themes Gives Better Control on How, Which and When You Want to Load Your JavaScript or CSS Files Like HTML Pages.

  • Nginx WordPress : Remove ?utm_source Like Query Strings From URL

    Here Is A Very Easy Guide On How To Remove ?utm_source Like Query Strings From URL In Nginx WordPress Setup To Force Serving Cached Webpages.

  • sqlmap Tutorial : WordPress SQL Injection Testing (White Hat)

    Here Is A sqlmap Tutorial For WordPress SQL Injection Testing For The Beginners To Test Own Website For Potential Vulnerabilities & Fix Them.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What Online Casinos Have No Deposit Bonus in Australia March 30, 2023
  • Four Foolproof Tips To Never Run Out Of Blog Ideas For Your Website March 28, 2023
  • The Interactive Entertainment Serving as a Tech Proving Ground March 28, 2023
  • Is it Good to Run Apache Web server and MySQL Database on Separate Cloud Servers? March 27, 2023
  • Advantages of Cloud Server Over Dedicated Server for Hosting WordPress March 26, 2023

About This Article

Cite this article as: Abhishek Ghosh, "MySQL Queries to Change WordPress HTTP to HTTPS," in The Customize Windows, September 7, 2014, March 31, 2023, https://thecustomizewindows.com/2014/09/mysql-queries-change-wordpress-http-https/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT