.NET Url重写根URL [英] .NET Url rewrite the root url
本文介绍了.NET Url重写根URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在IIS7中有以下规则:
I have the follow rule in IIS7:
<rule name="RewriteAll" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{URL}" negate="true" pattern="\.axd$" />
<add input="{URL}" negate="true" pattern="\.png$" />
<add input="{URL}" negate="true" pattern="\.gif$" />
<add input="{URL}" negate="true" pattern="\.jpg$" />
<add input="{URL}" negate="true" pattern="\.css$" />
<add input="{URL}" negate="true" pattern="\.js$" />
</conditions>
<action type="Rewrite" url="default.aspx?page={R:1}" />
</rule>
这个捕捉网址如 http://mysite.com/contact/
我无法弄清楚使用规则来捕获 http://mysite.com/ 并发送至例如home.aspx。任何人都可以帮助我匹配正则表达式
I can't figure out with rule to use to catch http://mysite.com/ and send to for example home.aspx. Can anyone help me with the match regex
推荐答案
我通过添加以下规则来修复它:
I fixed it by adding the following rule:
<rule name="Index Request" enabled="true" stopProcessing="true">
<match url="^$" />
<action type="Rewrite" url="index.aspx" logRewrittenUrl="true" />
</rule>
这篇关于.NET Url重写根URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文