.htaccess htaccess:打开和关闭特定URL的https?

.htaccess htaccess:打开和关闭特定URL的https?,.htaccess,mod-rewrite,https,expressionengine,.htaccess,Mod Rewrite,Https,Expressionengine,我正在尝试配置一些条件重定向,我想要的是: 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规则正在强制/l

我正在尝试配置一些条件重定向,我想要的是:

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]

命令允许,拒绝
全盘否定
重新启动发动机
重写cond%{SERVER_PORT}80
重写规则^(.*)-[E=site\u url:http://www.example.com]
重写cond%{SERVER_PORT}443
重写规则^(.*)-[E=site\u url:https://www.example.com]
重写cond%{SERVER_PORT}80
重写cond%{REQUEST_URI}/帐户
重写规则^(.*)$https://www.example.com/$1[R,L]
重写cond%{SERVER_PORT}443
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}!(/账户)
重写规则^(.*)$http://www.example.com/$1[R,L]
我想问题在于
RewriteCond%{REQUEST\u URI}!(/account)
规则。我尝试了很多变化,到处都搜索过,但没有找到任何符合我想要做的事情

因此,为了澄清下面的所有内容,
/account
必须是https,其他所有内容都应该是http

对于信息,这是一个表达式引擎站点,因此这些不是物理文件或目录,而是动态生成的URL

任何帮助都将不胜感激。

试试这个

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} /account
RewriteCond %{REQUEST_URI} !(login/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) 
RewriteCond %{REQUEST_URI} (login/account)
RewriteRule ^(.*)$ http://www.example.com/$1 [R,L]
特定于ExpressionEngine的HTTPS/HTTP示例:

谢谢你,但是运气不好,还是得到了同样的结果。谢谢你的链接,我会看一看,看看能不能找到答案。经过多次调整后,我终于找到了答案,只是对你的建议做了一些小小的修改。所有的
RewriteCond
语句都需要包含
/account?*
,但这只是针对我的特定站点。谢谢