Force HTTPS (HTTP Redirect) via htaccess

6th February 2018
by InfiniteMonkeys

For NGINX/Apache hosts:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_PORT} ^80
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule ^index\.php$ – [L]

Best done with a plugin on CMS/WP sites!