Forzare il redirect dalla porta 80 alla porta 443
Per attivare un redirect in automatico da un URL http al relativo https, basta creare un file .htaccess con le seguenti direttive:
|
1 2 3 |
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] |
Lo stesso risultato si può ottenere con:
|
1 2 3 |
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L] |