Wondering How to Redirect HTTP to HTTPS using htaccess? If your answer is yes, then read on.

There is no doubt that an SSL certificate is an extremely important element on your website. If your website does not have a valid SSL certificate, then browsers like Google Chrome, FireFox and other Chromium based browsers will show an insecure connection warning.

As a result, the website visitor might find your website suspicious and avoid visiting it. So if you don’t have an SSL certificate on your website yet, then it is high time that you do so.

And whenever it comes to installing an SSL certificate and redirecting all content from HTTP to HTTPS, htaccess method is one of the easiest ways available out there.

But before I go ahead and talk about the steps that you have to follow, let me just talk about what is SSL and why it is important.

So here we go:



What is SSL?

SSL stands for Secure Sockets Layer. As the name suggests, it has stuff to do with security. It is a standard security protocol that helps in establishing encrypted links between a web browser to an online communicate.

The main job of the SSL technology is to ensure that all the data transmitted through a web server to a web browser stays encrypted.

Also Read: How to start a Successful Website or Blog

Also to establish an encrypted connection you will need to get an SSL certificate. An SSL certificate can be availed free of cost and through purchases. HostSall Web Hosting offers free SSL to all of our customers regardless of their plans.

In case your Web Hosting provider doesn't offer you any type of SSL with your plan, you can go with free SSL certificates available online.

free SSL certificates would work fine enough for you. if you have a basic blog or a website. But if you are running a commercial or business website, it is highly important that you go for a paid one or consider switching to HostSall Web Hosting.

redirect http to https using htaccess

Why is SSL so important for your website?

  • Safe and Secure Transfer/Transaction: If you have an ecommerce website or doing online transactions, then SSL is extremely important. Without SSL, you are putting your customers and your business at a large risk of stealing credit card information and other data.
  • Helps in Website Ranking: According to Google, they do consider SSL as one of their ranking factors. So if you are interested in SEO, you must have an SSL certificated implemented.
  • User Trust Factor: Once you install an SSL certificate on your website, web browsers will show a Green bar on HTTPS.




How to Redirect HTTP to HTTPS using htaccess?

To redirect HTTP to HTTPS using .htaccess, you will of course need to edit the htaccess file. And there are two ways to do so. You can either use your hosting control panel if you are using web hosting company offers one. Or you can use FTP for VPS or other types of hosting in case if you don't have any control panel to work with.

Editing the htaccess file:

Before you go ahead and start editing the htaccess file, you must backup your existing htaccess file. So in case if things get messed up, you will be able to bring things back to normal.

Anyway, here are the steps that you have to follow in order to backup your htaccess file:

  • First of all, open your cPanel account or any other Control Panel.
  • Go to File manager.
  • Then click on settings from the top right corner.
  • Click on the Document Root for (the domain name) and check the Show Hidden Files.
  • Then save the settings.
  • After that, go to the public_html directory or wherever the files are hosted.
  • Over here, you will find the .htaccess file.
  • Simply select the file and click on the edit button from the top bar.
  • Click once on the .htachess file and then click on the “Edit” at the top bar.
  • A warning box will pop up, but click on Edit.
  • On the next page, a code editor will open. And from here, you will be able to edit the file.

Redirect http to https using htaccess:

  • Once you are on the code editor, simply scroll down to the bottom.
  • Over here, you will need to paste the below code:

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

  • After that, simply save the file and you are all done.
  • In case if the above method doesn't work for you or you are facing some issues on your website after editing the htaccess file, we highly recommend you to contact our Customer Support which is available 24x7.

Final Words:

So that was all for your question that says how to redirect http to https using htaccess. Now go ahead and try the steps out and see how they are working for you. Also, if there is anything you would like to ask, then do feel free to drop a comment below and we will try our best to help you out.

cat commands in linux

Cat Commands in Linux

What are Cat Commands in Linux? If you have ever used Linux, then you are probably already familiar with cat commands in Linux. Cat commands are pretty useful, and they are very popular and versatile command in the Linux ecosystem. And are used very often. There are four common usages of the cat command that

Read More »
how to redirect http to https using htaccess

Redirect HTTP to HTTPS using htaccess

Wondering How to Redirect HTTP to HTTPS using htaccess? If your answer is yes, then read on. There is no doubt that an SSL certificate is an extremely important element on your website. If your website does not have a valid SSL certificate, then browsers like Google Chrome, FireFox and other Chromium based browsers will

Read More »
java for ubuntu

How to Install Java for Ubuntu

Do note that the following method should work on all Ubuntu Desktops, as well as on Ubuntu-based distros like Linux Mint. There are multiple versions and types of Java one can install on his/her computer which can confuse beginners sometimes. However, if you are not sure which Java version you have to install, you can

Read More »
how to make a bootable pen drive

How to make Pen Drive Bootable

Having a bootable Pendrive is always recommended especially if you are dealing with fixing computers or switching between different OS or experimenting on something. But for beginners, making a bootable pen drive is one of the difficult task as it seems complex and probably doesn't work every time since that are a couple of things

Read More »
dual boot ubuntu with windows 10

Dual boot Ubuntu and Windows 10

A lot of people keep thinking of different ways in order to run Windows alongside of their Linux distro like ubuntu. And it makes sense since a lot of people simply cannot afford to have two different machines for two different purposes. And while Linux is the king, many Games and professional software like Adobe

Read More »
install chrome on ubuntu

How to Install Chrome on Ubuntu

There are two ways to install Google Chrome on Ubuntu or any Linux distribution built on top of Ubuntu. In this article, we will guide to install Google Chrome on ubuntu using both the ways which is via terminal and the GUI itself. Don't worry if you don't understand these terms. Google Chome is one

Read More »
HostSall © Copyrights 2020. All Rights Reserved.