Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URLRewriter for IIS 7 returns 404 Server Error

I've implemented "Approach 3: Using an HttpModule to Perform Extension-Less URL Rewriting with IIS7" from here: - http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

That is based on URLRewriter module: - http://urlrewriter.net/

It seems to work on my local environment but on production server (running IIS 7) it shows "404 - File or directory not found" page.

I've searched on Google and could not seem to find the solution.

In the end, we went back to IIS 6 and followed the instructions here which worked: - http://urlrewriter.net/index.php/support/installation/windows-server-2003

But someday we may have to upgrade to IIS 7 on a shared hosting environment and the same issue will appear again!

like image 737
Weng Fai Wong Avatar asked Dec 18 '25 01:12

Weng Fai Wong


1 Answers

The hosting dude got it to work in IIS 7. The HTTP handlers requires wildcard mapping with different application pool to make it work in IIS 7. Hope this helps.

Make sure you have the following in Web.Config:

<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <handlers>
    <add name="wildcard" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
  </handlers>
</system.webServer>
like image 166
Weng Fai Wong Avatar answered Dec 19 '25 16:12

Weng Fai Wong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!