【发布时间】:2012-04-17 16:01:19
【问题描述】:
我不明白为什么下面的方法不起作用
RewriteCond ${foobar:test:$1} ^
RewriteRule ^/?(.*)$ /check.php?url=$1 [L]
foobar 是一个程序(简单的 bash 脚本),我在其中写入文件以查看输入内容。 check.php 是一个简单的 php 脚本,它显示 GET 的内容。这是我将正则表达式 ($1) 传递给 shell 脚本和 php 脚本时得到的结果:
url check.php foobar
www.example.com/index.html index.html test:
www.example.com/index.php index.php test:
www.example.com/test.html test.html test:
基本上,模式在 RewriteRule 中被识别,但不是 foobar 的参数。
注意:shell 脚本没有任何问题。相反,如果我这样称呼它${foobar:test:abc123},则输出为“test:abc123”
【问题讨论】:
标签: regex bash mod-rewrite lamp