How to move a WordPress website from HTTP to HTTPS with NGINX

After I saw "How to install certificate SSL (HTTPS Connection) for a website hosted on a server NGINX without cPanel or VestaCP”In the article by here, let's see how to move a website WordPress on HTTP on HTTPS cu NGINX.

For a website or blog with WordPress, it is not enough to install the certificate SSL for it to be valid on the protocol HTTPS. Even if the certificate SSL was installed correctly and is valid, you probably noticed that when you access a page HTTPS, the "lock" does not appear in the address bar, 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 certificate correctly SSL, means that that page has local links left "http". These may 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 certificate SSL installed correctly and validly, we have a page where Firefox warns us that we do not have a secure connection.

Not Secure SSL Connection
Not Secure SSL Connection

It also tells us that there are parts of the page, such as the images, that are not secured. This means that somewhere in the content of the article or on the elements in the sidebar, we had an image file whose source link begins with "http" instead of "https".

To change the source of an image from “http"In"https"It would be easy 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 users of WordPress, is to change the local links in database. Switching links from "http" to "https” to be able to do with a simple command SQL executed from phpMyAdmin or from the command line SQL via Terminal.

How to move WordPress from HTTP to HTTPS.

If I 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 "http://ihowto.tips"In"https://ihowto.tips". These links can be image sources (src) and other links to internal pages.
Before starting work, we recommend you to make a backup of the database.

1. Born we authenticate to the database of the blog, via 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 command line:

UPDATE wp_posts SET post_content = REPLACE(post_content,'http://ihowto.tips','https://ihowto.tips');

Replace the web address and your domain name and take into account whether or not you use www. If you use the prefix "www", he must also be added.

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

How to move WordPress from HTTP to HTTPS.
Update SQL links HTTP to HTTPS

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

Careful! There are themes of WordPress (WP Themes) which once the domain URL has been changed will reset their customized configurations. Try to make a backup of these as well.

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » WordPress » How to move a WordPress website from HTTP to HTTPS with NGINX
Leave a Comment