0

I'm using ISAPI Rewrite 3 under ASP.NET / IIS 7.

My .htaccess file is pretty short:

RewriteEngine On
RewriteProxy ^(forum|events|support|_css|css|_js)(.*) http://othersite/$1$2

Requests like http://mysite/events/page1.aspx, or http://mysite.com/css/site.css, everything works great. However, requests for images http://mysite/images/smurf.gif are apparently not processed by ISAPI Rewrite, and I receive a 404 error.

The error page also references a weird url. For instance, if I request /images/smurf.png, the error page will show /images/smurf.png.rwhp. I think .rwhp stands for "RewriteHelper", and seems to be coming from ISAPI Rewrite itself. This suggests that the handler is processing the request, but is doing something very strange with it.

How can I get around this? Why is this only happening for images?

3Dave
  • 28,657
  • 18
  • 88
  • 151
  • For URL-Rewriting, why not use asp.net's url rewrite (Routing) feature? – TheGeekZn Nov 15 '12 at 13:30
  • Legacy. We've got around 600+ rules already in .htaccess, and quite a bit of stuff still running on IIS6/Win2k3. Converting them all to use app routing/IIS url rewriting will be a significant pain. – 3Dave Nov 15 '12 at 13:36
  • But, if you think about the exponentially growing system of coding - you need to figure out constants. URL rewriting in .Net is one of those constants developed by Microsoft and used everywhere :) – TheGeekZn Nov 15 '12 at 13:46
  • There are a lot of things I'd like to rewrite. In high-traffic, mission-critical systems, though, it's rarely as simple as it seems. – 3Dave Nov 15 '12 at 14:00
  • It may happen if /images is not an ordinary folder and ISAPI_Rewrite handler is removed for it. – TonyCool Nov 15 '12 at 14:02
  • @TonyCool since it's a reverse proxy rule instead of a rewrite (in fact, the folder is on a completely different server), then it shouldn't matter if ISAPI Rewrite is running there or not. My understanding is that basically issues a second request (browser -> server A -> proxy to server B) so whatever systems are in place there should still be working. Browser requests for the image directly form the second server work just fine. – 3Dave Nov 15 '12 at 14:09
  • It would be easier to help you if you create a ticket on HeliconTech helpdesk (support@helicontech.com). Please enable logging in httpd.conf and attach the rewrite.log for the non-working request. – TonyCool Nov 16 '12 at 13:30

0 Answers0