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:

123RewriteEngine OnRewriteCond %{HTTPS} offRewriteRule ^(.*)$ 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.

You can create or edit the .htaccess file either via FTP, or using with the File Manager available in cPanel.

About the Author

Sande Kennedy is the founder and Editor in Chief of SandeKennedy.co.ke & Kenyans247.co.ke He is a Kenyan-based Internetprenuer,blogger Political Activist & informer who has an interest in politics, governance, corporate-fraud and human-interest. Kindly drop me a note if you feel aggrieved on any matter that you would want to be highlighted  Twitter: @nyosake , Instagram: @itssandekennedy WhatsApp: +254791890826 Read More about me here