Url Rewriter works on localhost but not on production server

802 Views Asked by At

I've gotten URLRewriter to work on my localhot perfectly, but on production I get 404 errors.

I'm using IIS 6, and from what I read this should just work.

Here is what i have in my web.config:

<rewriter>
  <rewrite url="~/(\d+)$"       to="~/Items/Details.aspx?ItemId=$1" />
  <rewrite url="~/Items/(\d+)$" to="~/Items/Details.aspx?ItemIId=$1" />
</rewriter>

<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />


<httpModules>
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>

</httpModules>

Has anyone had a similar problem and solved it?

Thanks!

2

There are 2 best solutions below

1
On
<rewrite url="~/Items/(\d+)$" to="~/Items/Details.aspx?ItemIdId=$1" />

Is that GET parameter meant to be ItemId? Cos at the moment it's ItemIdId.

Hope this helps.

1
On

Its because you need to setup wildcard mapping on the production server. IIS6 only runs certain file formats such as .aspx etc, but doesnt map extensionless urls to the asp.net pipeline.

This tutorial will answer your question:

NOTE: You will need remote desktop access to your server so this isn't possible in shared hosting environments unless your host is willing to set this up on your behalf.