INFO: Force HTTPS using an .htaccess file

Applies To:

  • Linux Web Hosting

Description:

To force HTTPS it is possible to create or update an .htaccess file in the public_html folder to include the following:
 
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
It is important to ensure that the 'RewriteEngine On' line is not repeated within the .htaccess file and that it appears above any other 'Rewrite' lines.


Was this article helpful?

mood_bad Dislike 0
mood Like 1
visibility Views: 1056