Skip to main content

Redirect from http to https with htaccess

icysamon
Author
icysamon
I really love making things by hand and turning my ideas into reality.

Using an FTP tool, add the following content to .htaccess.

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

To prevent errors, add the following content as well.

RewriteOptions inherit   
RewriteEngine on   
Header set content-Security-Policy: upgrade-insecure-requests