How do I force HTTPS on my website?

November 3, 2017     0 comments

Create a .htaccess file in your public_html with the following:


RewriteEngine On

# www redirect
RewriteCond %{HTTP_HOST}//s%{HTTPS} !^www\. [NC]
RewriteRule ^(.*)$ http%3://www.%{HTTP_HOST}/$1 [R=301,L]

# force ssl
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

How helpful was this article to you?