How do I force all connections to the secure https protocol?

 January 12, 2016     0 Comments

You can force a redirect from http to https using mod_rewrite:

Place the following in a .htaccess file:

RewriteEngine On 
RewriteCond %{HTTPS} !=on 
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

Please, note that the .htaccess should be located in the web site main folder.

The .htaccess file should be placed in the folder where you need to force HTTPS. You will also need mod_rewrite support in apache.

How helpful was this article to you?

Posting has been disabled.