Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
.htaccess hot可防止将移动重写规则应用于特定文件夹_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess hot可防止将移动重写规则应用于特定文件夹

.htaccess hot可防止将移动重写规则应用于特定文件夹,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我的htaccess中有这些规则 RewriteEngine on RewriteCond %{HTTP_HOST} !^m\my site\.it$ RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|ipad|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] RewriteCond %{HTTP_COOKIE} !mobilecookie=true Re

我的htaccess中有这些规则

RewriteEngine on
RewriteCond %{HTTP_HOST} !^m\my site\.it$
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|ipad|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{HTTP_COOKIE} !mobilecookie=true
RewriteRule ^(.*)$ http://m.my site.it%{REQUEST_URI} [L,R=302]
我希望这条规则不适用于文件夹管理员及其内容。 我认为这应该是工作,如果放在下面的权利线

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/admin/ 
RewriteRule ^.*$ - [NC,L]
但事实并非如此。 非常感谢您的帮助。 谢谢

您可以使用:

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/admin/ 
RewriteCond %{HTTP_HOST} !^m\.
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|ipad|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{HTTP_COOKIE} !mobilecookie=true
RewriteRule ^(.*)$ http://m.my.site.it%{REQUEST_URI} [L,R=302]

如果只使用第一个RewriteRule并添加带有admin约束的RewriteCond,它是否有效?