steveosoule
8/11/2015 - 6:02 PM

Force HTTPS on non-www Domain

Force HTTPS on non-www Domain

RewriteEngine on

#Force non-www:
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L,NC,QSA]

# Force HTTPS
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L,NC,QSA]