How to force SSL with .htaccess

You can force an HTTPS connection on your website by adding these rules in your website's .htaccess file:

 

RewriteEngine On

RewriteCond %{HTTPS} off

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

 

The .htaccess file needs to be located inside the site's document root folder. If your website is in a sub folder, then the .htaccess should be placed in the corresponding sub folder.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to order a shared web hosting package

This article will walk you through the process of ordering a Linux web hosting service from...

Hosting and Domain Name Expiration and Renewal

When you register a domain name and set up web hosting for your website, it is important to keep...

Fees for Late Renewal of Domain Names and Web Hosting

If you do not renew your domain name and web hosting on time, you may be charged extra fees. Your...

How to Create a Subdomain in the cPanel

As of cPanel version 106, the "Subdomains" section has been removed, and subdomain management has...