0
我希望將某些頁面從http重定向到https(具有表單和登錄頁面的頁面)以及其他頁面,並將https重定向到http。只在一個頁面中將http重定向到https,其他頁面https重定向到http
我如何在沒有爲每個頁面編寫所有規則?
我希望將某些頁面從http重定向到https(具有表單和登錄頁面的頁面)以及其他頁面,並將https重定向到http。只在一個頁面中將http重定向到https,其他頁面https重定向到http
我如何在沒有爲每個頁面編寫所有規則?
您可以使用/root.htaccess如下:
RewriteEngine on
#redirect /login from http => https#
RewriteCond %{HTTPS} off
RewriteRule ^login https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]
#redirect any other request excluding /login from https to http#
RewriteCond %{HTTPS} on
RewriteRule !^login http://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]
它不是固定既保護了登錄頁面,如果認證cookie是到http網頁訪問。用身份驗證表單管理網站的唯一安全方法是使用https無處不在和hsts。 – Tom