Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.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/6/apache/8.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
Php 我们可以忽略特定域的htaccess重写规则吗?_Php_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Php 我们可以忽略特定域的htaccess重写规则吗?

Php 我们可以忽略特定域的htaccess重写规则吗?,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,目前,我已经在.htaccess中编写了以下重写条件和规则 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteRule ^(.*)$ /$1 [L,R=301] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^([^.]+)\. RewriteCond %{DOCUMENT_ROO

目前,我已经在.htaccess中编写了以下重写条件和规则

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ /$1 [L,R=301]

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.
RewriteCond %{DOCUMENT_ROOT}/%1/ -d
RewriteCond %{REQUEST_URI}::%1 !^/([^/]+).*::\1
RewriteRule ^(.*)$ /%1/$1 [L]
</IfModule>

重新启动发动机
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写规则^(.*)$/$1[L,R=301]
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写cond%{HTTP\u HOST}^([^.]+)\。
重写条件%{DOCUMENT_ROOT}/%1/-d
重写条件%{REQUEST_URI}::%1^/([^/]+).*::\1
重写规则^(.*)$/%1/$1[L]
我希望这些规则不适用于特定领域,例如www.example.com。 我们能做到这一点或其他任何选择来实现这一点吗

我希望这些规则不适用于特定领域,例如
www.example.com

您可以在
行的
重写引擎下方插入此规则:

# ignore all the rules for www.example.com domain
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^ - [L]

这并不能解决我的问题,上面的规则是用文档根映射的。因此,每个域都用文档根映射到其相应的域名,例如,用“示例”文档根映射。我需要忽略特定域的这些规则。