的Javascript CSS图像不显示
问题描述:
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>
答
尝试<match url="^([_0-9a-z-]+)/([_0-9a-z-]+)$" />
而且我通常会添加一个角色重写每一个网页,让你不会在URL需要的.aspx 。因此,您可以编写www.domain.com/home而不是www.domain.com/home.aspx,www.domain.com/subpage/contact而不是www.domain.com/subpage/contact.aspx等。
<rule name="no_aspx" stopProcessing="true">
<match url="^([a-z0-9/]+)$" ignoreCase="true"/>
<action type="Rewrite" url="{R:1}.aspx"/>
</rule>
我做了更改,但没有更改 – Yagnesh