2016-04-07 16 views
1

我用這個重定向代碼.htaccess強制所有地址使用HTTPS在一個頁面上:力HTTP當其他網頁forcet到HTTPS

RewriteEngine On 

RewriteCond %{HTTPS} off 
RewriteRule (.*) https://Domain.com%{REQUEST_URI} [L,R=301,NC] 

RewriteCond %{HTTP_HOST} ^www.Domain.com [NC] 
RewriteRule (.*) https://Domain.com%{REQUEST_URI} [L,R=301,NC] 

我想一個解決方案,迫使只有一個像domain.com/example頁只使用http而不是強制使用https。 我如何修改重定向代碼?

非常感謝

回答

0

要exclule從HTTPS重定向頁面,則可以使用:

RewriteEngine On 

RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} !^/example 
RewriteRule (.*) https://Domain.com%{REQUEST_URI} [L,R=301,NC]