How to go from http to https

If you have a website without a security certificate, you are the ugly duckling of the internet ;). Google has set out to make the internet safer and it is succeeding. If you haven't thought about it yet how to go from http to https You will do it in the coming months as Chrome will conspicuously mark your website as insecure.

Going from http to https is easy, but you have to make a series of changes to your website.

It is not the same with a new website than with a website that already exists

If you are creating a new website it is much easier since you only have to install your website directly with the certificate installed.

On the other hand, if you already have a website, it will not be enough to install the certificate, but you will have to do a series of tasks to transfer all your content from http to https.

Here is the video tutorial:

Subscribe to my channel:  

1 Step: Install the Certificate on your Server

More and more web hosts are offering the free security certificate. Specifically the certificate Let's Encrypt.

If you are not sure if your hosting offers it, ask them directly.

In this step you depend on your hosting, unless you have a dedicated server they have to install it for you or you have to have an option in your control panel to install it.

In most hosting it is as simple as activating it. In my hosting it comes like this:

how to go from http to https

Once installed you can check that everything has gone well in the next page

You add your website and it tells you if it has found the installed certificate:

check installed ssl

2 Step: Configure WordPress with the Certificate

Before getting down to work, I recommend that you make a backup 😉

Now that we know that we have our certificate properly installed, we have to configure our WordPress to use it.
To do this, we enter the WordPress control panel, go to Settings -> General and in both the "WordPress Address" and "Site Address" fields we change the URL with https:

change url https

Once saved, WordPress will take us out of the administration area to log in again, but this time already within https.

Be very careful that a friend of mine has changed the url in WordPress without having installed the certificate on the server and called me saying: "Óscar, this certificate thing doesn't work for me" 😉

Step 3: Fix HTTP Content Errors

Now, when you enter your website, it may happen that instead of seeing the green bar you see that it has an information sign:

https sign information

Instead of the green bar:

green bar https

This is because, although we already have the security certificate installed, we have elements within our website that call http instead of https.

It usually happens with images. For example if I edit the article I can see that the image is in http instead of https:

How to go from http to https 1

We can change it manually but if we have a website with a lot of content it can be crazy.

We can solve it in a much simpler way. There is a plugin called Better Search Replace which will allow us to quickly change in the database in all the places that appears http instead of https.

Once the plugin is installed we go to Tools –> Better Search Replace:

In Search for: We add our website without https, that is, the url with http
In Replace with: We add our website with https

We select all the tables and uncheck the option Do you want to run a drill?

Remaining as follows:

https better search replace

And if everything went well, you already have your website in https with a green bar all over your website 😉

Step 4: Redirect traffic from http to https

If our website has content, it is possible that other websites have linked us and we have visits to the website but it is directed to http, so we have to direct all those visits to the new version with https.

Many servers have the option to do it from the hosting itself, in my case the option is the following:

server redirect https

If our server does not offer us that possibility, we do not have a problem either, we can do it manually.

We have to edit the .htaccess file of our server and add the following code:

# Redirigir siempre a https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

And now if a visitor enters our website in the http version, they will be automatically redirected to https.

I hope it works for you 😉

regards

8 comments on “How to go from http to https”

  1. By the way… tell me to go to Google Search Console and Google Analytics to add the https too?
    Google has to re-index all pages????
    or when redirecting with .htacces will it catch it fine?

    • Hello, Gerardo,

      You have to add it again in Google Analytics and Google Search Console because in the eyes of Google it is a new page.

      Thanks to the redirections, Google knows that now this website is the one to which we put all the force, but if you want to see all the information from Google search console, you have to add it again as if it were a new website.
      Greetings 😉

  2. After fighting for two days with the program and the technician told me that I had to check only the http … it turns out that with 4 changes and with your wonderful code I have finally managed to get the padlock to appear !!!

    THANK YOU SO MUCH OSCAR!!!!

Answer to Gerardo Cancel reply