Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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
Apache 使用OR和NC进行htaccess重定向_Apache_.htaccess_Redirect_Case_Case Sensitive - Fatal编程技术网

Apache 使用OR和NC进行htaccess重定向

Apache 使用OR和NC进行htaccess重定向,apache,.htaccess,redirect,case,case-sensitive,Apache,.htaccess,Redirect,Case,Case Sensitive,我想知道我是否可以在我拥有域的地方进行重定向:example.com与IP的or语句一起不区分大小写。两者独立工作,但不是一起工作 RewriteCond %{HTTP_HOST} ^example\.com [OR] [NC] RewriteCond %{HTTP_HOST} ^123\.45\.67\.89 RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteCond%{HTTP_HOST}^example\.com[OR]

我想知道我是否可以在我拥有域的地方进行重定向:example.com与IP的or语句一起不区分大小写。两者独立工作,但不是一起工作

RewriteCond %{HTTP_HOST} ^example\.com [OR] [NC] RewriteCond %{HTTP_HOST} ^123\.45\.67\.89 RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteCond%{HTTP_HOST}^example\.com[OR][NC] 重写cond%{HTTP_HOST}^123\.45\.67\.89 重写规则(.*)http://www.example.com/$1[R=301,L]
标志应以逗号分隔列在一起——与重写规则本身的方式完全相同:

RewriteCond %{HTTP_HOST} ^example\.com [OR,NC]
RewriteCond %{HTTP_HOST} ^123\.45\.67\.89
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
另一种方法:

RewriteCond %{HTTP_HOST} ^(example\.com|123\.45\.67\.89) [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]