Rewrite Rule Malfunction on Win2003 x64

Topics: User Forum
Apr 26, 2010 at 8:11 PM
Edited Apr 26, 2010 at 8:13 PM
I have the following rule in my iirf.ini:
# Rewrite all requests for "app/assets/1E520AA9-452A-43E9-800F-9B826E0EF23C.jpg?width=320" to
# app/assets/getImageAsset.aspx?id=41E520AA9-452A-43E9-800F-9B826E0EF23C&width=320
RewriteCond %{HTTP_URL} (([^/]+){1})?/app/assets/.*\.jpg(\?[^#]+)?$
RewriteRule (.*)/app/assets/(.*)\.jpg(\?([^#]+))?$ $1/app/assets/getImageAsset.aspx?id=$2&$4 [U,L]

It works fine for most of my installs but one. The particular one is running on Windows 2003 x64 and it seems to ignore the query string all together (the "(\?([^#]+))?" part). The $4 replacement string is always empty. I've also tried using the [QSA] flag with no luck.

Any ideas why this might be happening?
Coordinator
Apr 26, 2010 at 9:46 PM

Not without a log.

Seems like it should work just fine.

You definitely don't need the RewriteCond, though.  The condition checks the HTTP_URL server variable - in other words, the URL path - against a particular pattern.  But the URL is also what the RewriteRule handles.  So the RewriteCond using HTTP_URL is redundant.  Ideally you should use one or the other - either use the pattern matching in the RewriteCond on the HTTP_URL variable, or use the pattern matching in the RewriteRule, but not both.