2011-04-05 69 views
2

我正在运行IIS7.5和URL重写模块。iis7中的URL重写

我跟着这些一步一步的指示,以使用户友好的URL:

Rule Templates for the URL Rewrite Module - User Friendly URL - rule template

如果我进入,而不是http://domain.com/default.aspx网站抛出404: file not found error的URL http://domain.com/default/

这里是我的重写规则:

<rewrite> 
    <rules> 
    <rule name="RedirectUserFriendlyURL1" stopProcessing="true"> 
     <match url="^demourl\.dev\.asenetechdev1\.com/default\.aspx$" /> 
     <conditions> 
     <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /> 
     </conditions> 
     <action type="Redirect" url="demourl.dev.asenetechdev1.com/default" 
       appendQueryString="false" /> 
    </rule> 
    <rule name="RewriteUserFriendlyURL1" stopProcessing="true"> 
     <match url="^demourl\.dev\.asenetechdev1\.com/default$" /> 
     <conditions> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="false" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" /> 
     </conditions> 
     <action type="Rewrite" url="demourl.dev.asenetechdev1.com/default.aspx" /> 
    </rule> 
    </rules> 
    <outboundRules> 
    <rule name="OutboundRewriteUserFriendlyURL1" preCondition="ResponseIsHtml1"> 
     <match filterByTags="A, Form, Img" 
      pattern="^(.*)demourl\.dev\.asenetechdev1\.com/default\.aspx$" /> 
     <action type="Rewrite" value="{R:1}/ demourl.dev.asenetechdev1.com/default" /> 
    </rule> 
    <preConditions> 
     <preCondition name="ResponseIsHtml1"> 
     <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /> 
     </preCondition> 
    </preConditions> 
    </outboundRules> 
</rewrite> 

我也使用Intelligencia.UrlRewriter这种尝试。但我能够在本地以及服务器上生成友好的网址,但我希望获得无扩展名的网址,该网址在本地服务器上运行正常,但不在活动服务器上运行。

+0

你忘了包含你的'web.config'设置... – Druid 2011-04-05 17:08:34

回答

1

您的图案目前不符合/默认/。它仅匹配/默认

更改

<match url="^demourl\.dev\.asenetechdev1\.com/default$" /> 

<match url="^demourl\.dev\.asenetechdev1\.com/default/{0,1}$" /> 

应该这样做。