How to Force SSL with htaccess

this needs to be done for several proposes

Now days web security require each domain to use Secure Socket Layer SSL certificate. There are plenty available on the market from free to ones very expensive. Check our blog if you need to install SSL on your domain or on WHM server.

Now when you have SSL on your domain you need to route all the traffic via HTTPS protocol. This needs to be done for several proposes:

  • to ensure all traffic is encrypted and secure
  • to avoid double content pages (titles and meta descriptions)

To force an HTTPS connection on a website just add these simple rules in your website's .htaccess file:

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

This .htaccess file must be placed inside a website's document root folder. If website is in a sub folder, then the .htaccess should be placed in the corresponding sub folder.

Sergio Avatar

Sergio Sviridov

Information Delivery Specialist


SEO, Design and Marketing Blog

Benefits of Google Maps Street View
Benefits of Google Maps Street View
Top 10 Communication Channels for Your Business
Top 10 Communication Channels for Your Business
How to Change Your Name on Facebook
How to Change Your Name on Facebook

Number of Total Worldwide Registered Domains Updated: Apr 19 2021