Skip to main content

Redirect from http to https with htaccess

icysamon
Author
icysamon
Electronics & Creator

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