How to move a blog or a WordPress website from HTTP to HTTPS (NGINX)

After I saw "How to install an HTTPS Connection (SSL) certificate for a hosted website on an NGINX server without cPanel or VestaCP”In the article by here, let's see now what we need to do to make the website or blog valid HTTPS.

For a WordPress-based website or blog, it is not enough to install the SSL certificate for it to appear valid in the "address bar". Even if the SSL certificate was installed correctly and is valid, you have probably noticed that when you access an HTPPS page, the "lock" does not appear in the address bars, a sign that the page is safe.

If your blog or website does not appear to have a secure connection (Connection is Not Secure) even if I installed the SSL certificate correctly, it means that that page remained local "http" links. These can be direct links to media files (pictures, videos, songs) or to structural elements (java, CSS).

We take the example iHowTo.Tips, which although it has one SSL certificate installed correctly and valid, we have a page where Firefox warns us that we do not have a secure connection.

It also tells us that there are parts on the page, such as images, that are not secure. This means that somewhere in the content of the article or on the elements in the sidebar, I had an image file whose source link starts with "http" instead of "https".
To change the source of an image from "http" to "https" it would be simple to edit that article. If we talk about a website with hundreds or thousands of articles, things change. Editing each article would be an operation that would take a long time. The easiest for WordPress users, is to change the local links in database. The transition of the links from "http" to "https" can be done by a simple SQL command executed from phpMyAdmin or from the SQL command line via Terminal.

How to change links from "HTTP" to "HTTPS" for a WordPress blog or website via SQL

If still mentioned above iHowTo.Tips, let's take it as an example and further. Let's say we have to replace on that blog, all the links in the form ""In"". These links can be image sources (src) and other links to internal pages.
Before you get started, we recommend

1. Born we authenticate to the database of the blog through phpMyAdmin. User and password we find them in the file wp-config.php from the domain root.

2. We make Click the database name on the leftThen click on SQL in the top horizontal menu.

3. We execute in SQL the command line:

UPDATE wp_posts SET post_content = REPLACE(post_content,'','');

Replace your web address and domain name and consider whether or not to use www. If you use the prefix "www", it must also be added.

4. Click "Go" to execute the command line.

The command line indicated above will only change the URLs in the "wp_posts" table, the "post_content" column. You can change this SQL command line to replace the URL in all database tables.

Careful! There are WordPress themes (WP Themes) that once changed the domain URL will reset their custom settings. Look for a back up to these.

How to move a blog or a WordPress website from HTTP to HTTPS (NGINX)

About the author


Passionate about everything gadget and IT, I write with pleasure on since 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment