Redirect http to https using .htaccess in cpanel on Hostchilly

We all want to stay safe on the internet and it's easier to do so when SSL (Secure Sockets Layer) is in use. SSL ensures that all communications between your web browser and the site you are visiting is encrypted. Sites using SSL will usually show a green padlock at the start of your browsers address bar.

This article shows you how to have the web server force all connections to your site using SSL, this means all connections will be made using https:// instead of http://. Keeping your information safe from hackers.

 

Prior to completing these steps you need to ensure that a valid SSL certificate is in place for the domain you want to force SSL on.

This can be a purchased/EV SSL certificate or a free Let'sEncrypt certificate. 

To force SSL connections to a site edit the .htaccess file in the folder containing the site. You can do this through cPanel File Manager or via FTP (download the file, edit it and upload again).

Add the following lines to the top of the .htaccess file

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

After saving the file, try visiting your website using a http:// URL - you'll find that it gets redirected to the https:// version


 
  • How do I redirect all http to https?
  • 699 Users Found This Useful
Was this answer helpful?

Related Articles

How To contact Domain With Hostchilly SSD Linux Shared Hosting?

If you have active Linux SSD Shared Hosting you can find the nameservers we've sent via email to...

Can I host multiple websites with one Shared Hosting plan?

Yes, you can host multiple sites depending upon resources allocated. We only monitor CPU, RAM,...

What is SSD?

SSD stands for Solid State Drive. They're the most recent variety of hardware device. Of late...

How do I edit my php.ini file?

It can all be done through cPanel with just a few clicks! Just login to cPanel and navigate to...

Refund Policy- Hostchilly

Refund Policy 15 Day Money Back Period We provide a 15-day money back guarantee on all...