【发布时间】:2013-03-25 11:29:30
【问题描述】:
我正在尝试配置一些条件重定向,我想要的是这样的:
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下面的所有内容必须是https,其他所有内容都应该是http。
对于信息,这是一个表达式引擎站点,因此这些不是物理文件或目录,而是动态生成的 url。
任何帮助将不胜感激。
【问题讨论】:
标签: .htaccess mod-rewrite https expressionengine