How to redirect from http to https [TUTORIAL]

Hello, in this tutorial we will show you how to force URL redirection from http to https on your website/WordPress or any other CMS (Content Management System) so that your website would be in compliance with Google guidelines for security and SEO. As you know, Google Chrome will start to mark non-HTTPS sites as “not secure” starting July 2018.

July 2018 is right around the corner and so is Google Chrome update no. 68. In this update, Google announced that it will mark all non-HTTPS site as “non-secure” which means that all users visiting your website, will see a message that “this website is insecure“.

Non SSL Site Warning

Non SSL Site Warning

Google has started implementing this since last year and also has said that the HTTPS sites will be favored in their Ranking Algorithm. As you know Ducadu offers free SSL Certificate to all Cloud Hosting plans. The SSL Certificate is signed by Let’s Encrypt. In almost all cases, as soon as you buy a cloud hosting plan with a new domain, the SSL Certificate will be available right away. There are some exceptions like firewall plug-ins found on WordPress/ Joomla/ OpenCart installations that will block the script that generates the SSL Certificate. This happens if you already have a website with that firewall plug-in. If it’s a default installation then you won’t have any problems.

How to force SSL Certificate on your website

To force the SSL Certificate on your website you will need to edit the file .htaccess and add these three lines on top. To do this you have to log in into your cPanel account, usually found at https://yourwebsite.com/cpanel and then search for “File Manager“. A new tab will open and you will have access to all of your files. Be careful what you modify because it might damage your website.

  1. After you’ve logged in and opened the “File Manager” search for “public_html” folder and enter it.

    Enter the "public_html" folder

    Enter the “public_html” folder

  2. Look for the file .htaccess, select it and then click the “Edit” button

    cPanel .htaccess edit buton

    cPanel .htaccess edit buton

  3. If you can’t see the .htaccess file, make sure to click on the top-right corner the “Setting” button and then check “Show Hidden Files (dotfiles)” and after that click on “Save” button.

    cPanel setting show hidden files check

    cPanel setting show hidden files check

  4. Copy and paste the code below in you .htaccess file and then click on “Save Changes” button
    RewriteEngine On
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    

    cPanel copy-paste code and save

    cPanel copy-paste code and save

After you’ve done all the steps above, you should look for a plugin that will look into your database for all the links that contains “http://” and change it to “https://“. You can also do this by using the “phpmyadmin” in you cPanel account. But be aware, before you start this, you should do a full backup of your site and database.

That’s it! This is all you have to do to force-rewrite http to https on your website no matter what CMS are you using. The level of difficulty is low, but you have to be careful what file are you modifying. Now you can go to your  website and check if the https redirection is functional. Just open a new tab in your browser and type http://yourwebsite.com and it should redirect you to https://yourwebsite.com.

Congratulations, now you are ready for Google Chrome Update no. 68 in July. If you find this tutorial interesting, please share it across your Social Media profiles.

%d bloggers like this: