开发者

Url Rewriter works on localhost but not on production server

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, Intellige开发者_JAVA百科ncia.UrlRewriter"/>

</httpModules>

Has anyone had a similar problem and solved it?

Thanks!


<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.


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:

  • http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-Extensions-in-ASP.NET.aspx

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜