我打算重定向此URL:http://localhost/iiif/http/image-service/papyrus,1/full/400,300/0/default.jpg
至http://localhost/iiif/http/image.php?req=763648&id=papyrus,1®ion=full&size=400,300&rotation=0&quality=default&format=jpg
重写规则如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /iiif/http/
RewriteRule image-service/(.*)/(.*)/(.*)/(.*)/(.*).(.*)$ image.php?req=763648&id=$1®ion=$2&size=$3&rotation=$4&quality=$5&format=$6 [R=301,NC,L,P]
</IfModule>
其结果是:
Array
(
[req] => 763648
[id] => papyrus,1
[region] => full
[size] => 400,300
[rotation] => 0
[quality] => default.jp.
)
而不是:
Array
(
[req] => 763648
[id] => papyrus,1
[region] => full
[size] => 400,300
[rotation] => 0
[quality] => default
[format] => jpg
)
我怀疑这是由于网址中出现了句点/点(.)。我该如何纠正它呢?
2条答案
按热度按时间dvtswwa31#
我建议你这样使用重写规则:
明细:
[^/]+
,而不是可以匹配任何内容的贪婪.*
R=301
和P
标志,因为您需要的只是内部重写jm81lzqq2#
您需要转义文件扩展名前的句点
请注意,在最后两个
(.*)
捕获组之间添加了反斜杠\