You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by 付 传淮 <fu...@outlook.com> on 2019/04/30 16:28:17 UTC

[users@httpd] 答复: RewriteRule overbinding in 2.2

Will cancelling the order return the $10 I paid before?

发件人: Aaron Macks2 <aa...@harvardbusiness.org>
发送时间: 2019年4月30日 23:05
收件人: users@httpd.apache.org
主题: [users@httpd] RewriteRule overbinding in 2.2

I have a problem with a RewriteRule where it appears to be over-binding in the REGEX:

RewriteRule ([0-9]{4,6}(?:-[0-9]{1,2})?\.jpg)$     /cgi-bin/logo-image.pl?image=$1 [L,PT]
What it should do is bind a 4-6 digit number, followed by an optional - and a 1-2 digit number, and finally .jpg, at the end of the URL, and send them as a query string to the backend. It works fine unless there is another 4-6 digit number in the URL, e.g.,

https://site.url/images-sold/foo-bar-498-24340-1.jpg
works, calling /cgi-bin/logo-image.pl?image=24340-1.jpg, but

https://site.url/images-sold/foo-bar-49899-24340-1.jpg
calls /cgi-bin/logo-image.pl?image=49899-24340-1.jpg.
I've tried as 2 seperate regexes, and gotten the same response

RewriteRule ([0-9]{4,6})(-[0-9]{1,2})?\.jpg$     /cgi-bin/logo-image.pl?image=$1$2.jpg [L,PT]
I verified the regex as valid PCRE and tested as best I can with the htaccess tester here https://htaccess.madewithlove.be/
but cannot seem to figure it out
Aaron

apache version: 2.2.15-69
OS: Centos 6.10
------------------------------------------------
Aaron Macks
Systems Architect