簡體   English   中英

htaccess HTTP到https與PHP例外

[英]Htaccess http to https with php exception

我最近將我的網站更改為https,並使用.htaccess進行重寫以使用此通過https發送所有內容...

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

但是,一個頁面(contact-us.php)在幾個瀏覽器(IE和Chrome)上引發了https錯誤,我試圖修復這些錯誤,但是它們很困難。 對我來說,最簡單的解決方法是將違規頁面(contact-us.php)設置為全局http to https規則的例外。 但是如何?

預先感謝您的任何答復。

您可以使用:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/contact-us\.php [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]

RewriteCond %{HTTPS} on
RewriteRule ^contact-us\.php http://%{HTTP_HOST}/contact-us.php [NC,L,R=302]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM