How to convert HTTP to HTTPS using htaccess

The letter 'S' in the word HTTPS stands for "secure". Website URLs with HTTPS are usually needed to give Google assurance that data transfers on your website are secure and data cannot be intercepted in the middle of the 'journey'. There are two ways to redirect HTTP to HTTPS that you can choose, namely via .htaccess from cPanel.

.htaccess is a multifunctional file contained in websites. You can get a variety of functions from .htaccess, from blocking IP addresses, protecting passwords to converting HTTP to HTTPS. Check out how to redirect HTTP to HTTPS via the following .htaccess. But before that, make sure you have access to manage cPanel.

  1. Login to your cPanel - If you are a MikyHost.com customer, to log in to your cPanel, you can go through the Client Area. In the Client Area, select Service>My services, then select the service product that you have purchased. Then scroll down, in the shortcut section, you can choose one of the cPanel menus. To go to the front page of cPanel, you can select the Home icon or the homepage.
  2. Find file manager menu, then click to open.
    file manager.png
  3. Select public_html, then right click on .htaccess and click “Edit”, then when a popup appears, select “Edit” at the bottom of the popup. However, if you don't find “.htaccess”, click “Settings” on the top right as shown in the image, then put a check mark on “Show Hidden Files (dotfiles)”.
  4. Copy the following code, then paste it in the HTML page of your website.
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  5. After that, don't forget to click Save Changes.
Was this answer helpful?

Related Articles

What is Softaculous Installer in cPanel?

If you have been struggling with the world of websites and web hosting for a long time, surely...

What is the difference between Cpanel and Client Area

There is a significant difference between cPanel and Client Area. To avoid misunderstandings, we...

How to make a Full Backup in Cpanel

Before you do a full backup on your hosting account, make sure the hosting disk space is...

How to change cPanel language to Indonesian

Maybe you are getting bored with English in your cPanel and you want to replace it with...

How to Redirect Domain via cPanel

Here's how to redirect a domain to another website via cPanel that you can try. 1. Login to...