Home  >  Article  >  Backend Development  >  .htacess 中RewriteCond下令的“^"符号含义

.htacess 中RewriteCond下令的“^"符号含义

PHP中文网
PHP中文网Original
2016-06-13 12:41:44862browse

在RewriteCond %{REQUEST_URI} !^/group/ 指令中^的含义



^ 定位符规定匹配模式必须出现在目标字符串的开头,

^以此字符串开头。

匹配字符串开始,完整就是,以非group目录开始的


RewriteCond指令格式

【说明】定义重写发生的条件
【语法】RewriteCond TestString CondPattern [flags]

RewriteCond指令定义一条规则条件。在一条RewriteRule指令前面可能会有一条或多条RewriteCond指令,只有当RewriteCond的条件(CondPattern)匹配成功时,RewriteRule的重写规则才被应用于当前URL处理。

举例说明RewriteCond命令规则

RewriteCond %{REMOTE_HOST} ^andelse.com [OR]
RewriteCond %{REMOTE_HOST} ^*.andelse.com
RewriteRule …针对这2个主机的规则集

RewriteCond % { HTTP_USER_AGENT }  ^Mozilla.*
RewriteRule ^/$ /homepage. max .html  [ L ]
如果你使用的浏览器识别标志是’Mozilla’,则你将得到内容最大化的主页homepage. max .html(含有Frames等等)。


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn