I intend to redirect this url:
http://localhost/iiif/http/image-service/papyrus,1/full/400,300/0/default.jpg
to
http://localhost/iiif/http/image.php?req=763648&id=papyrus,1®ion=full&size=400,300&rotation=0&quality=default&format=jpg
I have written the rewrite rule as:
<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>
The result is:
Array
(
[req] => 763648
[id] => papyrus,1
[region] => full
[size] => 400,300
[rotation] => 0
[quality] => default.jp.
)
instead of:
Array
(
[req] => 763648
[id] => papyrus,1
[region] => full
[size] => 400,300
[rotation] => 0
[quality] => default
[format] => jpg
)
I suspect that this is due to the presence of a period/dot(.) in the url. How can I correct it?
CodePudding user response:
I suggest you use this rewrite rule like this:
RewriteEngine on
RewriteBase /iiif/http/
RewriteRule image-service/([^/] )/([^/] )/([^/] )/([^/] )/([^/.] )\.(.*)$ image.php?req=763648&id=$1®ion=$2&size=$3&rotation=$4&quality=$5&format=$6 [NC,L,QSA]
Breakdown:
- Negated character class
[^/]
instead of greedy.*
that may match anything - Removal of
R=301
andP
flags from rewrite since all you want is an internal rewrite - Escaping last dot to match extension
CodePudding user response:
You need to escape the period before the file extension
/(.*)/(.*)/(.*)/(.*)/(.*)\.(.*)
Note the added backslash \
between the last two (.*)
capture groups