Apache 路径重写 问题
apache吧
全部回复
仅看楼主
level 1
人成从2D 楼主
配置Apache的重写条件时,TestString 如何引用 RewriteCond backreferences
这里是官方的文档但是用英文写的没看明白
地址:http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
TestString is a string which can contain the following expanded constructs in addition to plain text:
• RewriteRule backreferences: These are backreferences of the form $N (0 <= N <= 9). $1 to $9 provide access to the grouped parts (in parentheses) of the pattern, from the RewriteRule which is subject to the current set of RewriteCond conditions. $0 provides access to the whole string matched by that pattern.
• RewriteCond backreferences: These are backreferences of the form %N (0 <= N <= 9). %1 to %9 provide access to the grouped parts (again, in parentheses) of the pattern, from the last matched RewriteCond in the current set of conditions. %0 provides access to the whole string matched by that pattern.
TestString is a string which can contain the following expanded constructs in addition to plain text:
这里说除了普通字符串以为,还可以包括下面这几种类型 那么其中一项是 RewriteCond backreferences
再看后面关于RewriteCond backreferences的介绍
provide access to the grouped parts (again, in parentheses) of the pattern, from the last matched RewriteCond in the current set of conditions.
关键是from the last matched RewriteCond in the current set of conditions.这一句没明白
啥是the last matched RewriteCond ? 啥是in the current set of conditions?
是不是说 RewriteCond backreferences可以引用上面RewriteCond backreferences中的分组呢?
比如访问 http://localhost/a.php
RewriteCond %{HTTP_HOST} ^(local) 这里匹配的值是 local
RewriteCond %{HTTP_HOST} (%1host) 这里%1表示 引用上面的匹配到的local值
熟悉Apache的帮忙看看Apache 路径重写 问题
2015年08月25日 08点08分 1
1