0
我想配置一些有條件的重定向,我想是這樣的:htaccess:打開和關閉特定網址的https?
http://www.example.com/login
http://www.example.com/login/*
http://www.example.com/login/account
http://www.example.com/login/account/*
https://www.example.com/account
https://www.example.com/account/*
我的問題是當前的.htaccess規則迫使/login/account
下HTTPS運行,所以我得到這樣的:
http://www.example.com/login
http://www.example.com/login/*
https://www.example.com/login/account
https://www.example.com/login/account/*
https://www.example.com/account
https://www.example.com/account/*
這裏的現行規則:
<Files .htaccess>
order allow,deny
deny from all
</Files>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ - [E=site_url:http://www.example.com]
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ - [E=site_url:https://www.example.com]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} /account
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(/account)
RewriteRule ^(.*)$ http://www.example.com/$1 [R,L]
我想這個問題是與RewriteCond %{REQUEST_URI} !(/account)
規則。我嘗試了很多變化,並在各處搜索,但沒有找到任何符合我想要做的事情。
所以只是爲了澄清/account
以下的everthing必須是https一切應該是http。
有關信息,這是表達式引擎網站,所以這些不是物理文件或目錄,但動態生成的URL。
任何幫助將不勝感激。
感謝您的,但沒有運氣,還是得到同樣的結果。感謝您的鏈接,我會看看,看看我能不能弄明白。 – neilkb 2013-03-27 08:56:35
經過許多調整後,我終於在那裏對您的建議進行了一些修改。所有'RewriteCond'語句都需要包含'/ account?。*',但這只是特定於我的特定站點。謝謝 – neilkb 2013-03-27 13:40:40