Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http htaccess从重写规则中排除1个文件夹_Http_.htaccess_Mod Rewrite_Https_Directory - Fatal编程技术网

Http htaccess从重写规则中排除1个文件夹

Http htaccess从重写规则中排除1个文件夹,http,.htaccess,mod-rewrite,https,directory,Http,.htaccess,Mod Rewrite,Https,Directory,根据我的值是\uHTTP,我在下面的代码之后决定URL是https还是HTTP 我希望http://mydomain.com(查询字符串为空),http://mydomain.com/?q=home,http://mydomain.com/?qq=home。 下面的代码可以很好地用于这些URL,它设置为\uHTTP到1。一切都很完美。但我也希望管理文件夹的URL始终为httpS,所以我希望从该块中排除此类URL 这就是为什么我在下面的代码中添加了第二个字符串,但它并没有阻止这些URL应用Rewr

根据我的值是\uHTTP,我在下面的代码之后决定URL是https还是HTTP

我希望
http://mydomain.com
(查询字符串为空),
http://mydomain.com/?q=home
http://mydomain.com/?qq=home
。 下面的代码可以很好地用于这些URL,它设置为\uHTTP到1。一切都很完美。但我也希望管理文件夹的URL始终为httpS,所以我希望从该块中排除此类URL

这就是为什么我在下面的代码中添加了第二个字符串,但它并没有阻止这些URL应用
RewriteRule^-[E=IS_HTTP:1]
。为什么?

#determine if page is supposed to be http
RewriteCond %{REQUEST_URI} !^administration [NC]
#if it has q=home or qq=home in querystring
RewriteCond %{QUERY_STRING} (^|&)(q=home|qq=home)(&|$) [NC,OR]
#or if query string is empty
RewriteCond %{QUERY_STRING} ^$
#set env var to 1
RewriteRule ^ - [E=IS_HTTP:1]
同样,我想要
https://mydomain.com/administration/index.php
以及在重写规则之前要停止的文件夹/管理中的所有其他文件^-[E=IS_HTTP:1] 为什么上面的代码不能阻止它们

我尝试的第二个字符串是:

RewriteCond %{REQUEST_URI} !^administration [NC]
RewriteCond %{REQUEST_URI} !^/administration [NC]
但它们都不起作用。(我相信这里不需要/,因为请求URI不是从/开始的,但我可能错了)


谢谢。

代替此条件:

RewriteCond %{REQUEST_URI} !^administration [NC]
RewriteCond %{REQUEST_URI} !^/+administration [NC]
有以下情况:

RewriteCond %{REQUEST_URI} !^administration [NC]
RewriteCond %{REQUEST_URI} !^/+administration [NC]
请记住,
%{REQUEST_URI}
始终以斜杠开头,如果在浏览器中以这种方式键入,则可以有多个斜杠