ASP.Net URL重寫模塊我想要做的URL重寫與Intelligencia.UrlRewriter.RewriterHttpModule在ASP.Net這是我繼的System.Web在web.config中的Javascript CSS圖像不顯示
> <configSections>
> <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,
> Intelligencia.UrlRewriter" /> </configSections>
配置
<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter" />
</httpModules>
我想follwoing類型的URL
site.com/home site.com/contact site.com/info site.com/page/innerpage此 site.com/in/info
我寫下面的規則分別
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^Home$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="\.aspx$" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="Default.aspx" />
</rule>
<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
<match url="^contact$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="contact.aspx" />
</rule>
<rule name="RewriteUserFriendlyURL3" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="info.aspx?keyword={R:1}" />
</rule>
<rule name="Rewrite to page.aspx">
<match url="^pages/([^/]+)" />
<action type="Rewrite" url="page.aspx?page={R:1}" />
</rule>
<rule name="Rewrite to info.aspx">
<match url="([_0-9a-z-]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="info.aspx?keyword2={R:1}&keyword={R:2}" />
</rule>
</rules>
</rewrite>
</system.webServer>
<rewriter>
</rewriter>
一切工作正常,但如果最後使用規則我曾經得到和CSS/JavaScript停止工作,所有我嘗試了許多解決方案來解決CSS/JavaScript /圖像規則暗示,但沒有奏效。
site.com/in/info
<rule name="Rewrite to info.aspx">
<match url="([_0-9a-z-]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="info.aspx?keyword2={R:1}&keyword={R:2}" />
</rule>
我做了更改,但沒有更改 – Yagnesh