Apache的mod_rewrite混合重写外部重写程序

我使用以下configuration:

RewriteEngine On RewriteMap url-rewrite prg:/usr/bin/url-rewrite RewriteRule ^(.*)$ ${url-rewrite:%{HTTP_HOST}$1} [P] 

但有时重写的URL会混淆:

 127.0.0.1 - - [30/Jun/2011:15:12:37 +0300] [localhost...] [...] (5) map lookup OK: map=url-rewrite key=localhost/1.gif -> val=http://127.0.0.1:8080/path/2.gif 

url-rewrite脚本仅添加path段,但不会更改文件的名称。 我期望val = http://127.0.0.1:8080/path/1.gif 。 这导致用户实际上得到错误的图像文件。

注意:如果你想得到像上面这样详细的debugging日志(有性能影响),使用:

 RewriteLog /path/to/file.log RewriteLogLevel 9 

似乎url-rewrite脚本出错了,你应该发布这个脚本代码。

但在此之前,请检查您是否设置了RewriteLock指令,在使用prg: apache需要同步locking,而不是混合结果。