mod_rewrite weird behavior in wampserver 1.4.x ? DON'T WASTE YOUR TIME ! UPDATE!
Posted by: Celluloid (---.fbx.proxad.net)
Date: July 05, 2006 01:49PM

Hi,

Yesterday, I lost something like 4 hours before figuring wampserver 1.4.x had a HUGE bug in mod_rewrite, that is putting all matched pattern in lowercase (with or without the [NC] whose role is totally different) :
(snippet of the .htaccess) :
-------------------------
Options +FollowSymLinks
RewriteEngine On
# RewriteLog "rewrite.log"
RewriteBase /somedirectory/somemore/

RewriteCond %{QUERY_STRING} !vardump
RewriteRule ^img-([^-]*)-w-([0-9]+)-h-([0-9]+)-p-([^-]+)-img-(.*)$ imgscript.php?img=$5&w=$2&h=$3&page=$4&vardump=ok%{QUERY_STRING} [R=301,QSA]
-------------------------
What does the above rule :
take a path like
[www.example.com]
to
[www.example.com]
Where img is the path to a real image we want to be rescaled, watermarked, whatever...

Well, here was the trouble : SOMEENCODEDPATH is a urlencoded(base64_encoded(SOMEPATH)).

Well, after the rule being applied, every of the encoded paths was in lower case, hence rendering the decoding useless :
"path/to/TheImage_2006.jpg" becomes "cGF0aC90by9UaGVJbWFnZV8yMDA2LmpwZw=="
but "cgf0ac90by9uagvjbwfnzv8ymda2lmpwzw==" translates back into "rôiÏto/nj ãoçÎÿ2™Ö¶–jpÏ"
How fun, isn't it ? smiling smiley

Sorry, only registered users may post in this forum.