IIS URL重写 [英] IIS URL Rewrite

查看:86
本文介绍了IIS URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这真让我发疯...我正在尝试像这样重写我的网址:

Ok, this is driving me nuts... I'm trying to rewrite my urls like this:

Now:
http://www.somedomain.com/Somepage.aspx
http://www.somedomain.com/AnotherPage.aspx

Desired:
http://www.somedomain.com/somepage/
http://www.somedomain.com/anotherpage/

有人可以帮我吗?用户界面中的术语真是令人困惑.

Can anyone help me out with this? The terms in the User Interface are damn confusing.

谢谢.

推荐答案

我找到了答案:

<rewrite>
  <rules>
    <rule name="Redirect" stopProcessing="true">
      <match url="^([^\.]+)\.aspx$" />
      <conditions>
        <add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" />
      </conditions>
      <action type="Redirect" url="{ToLower:{R:1}}/" appendQueryString="false" redirectType="Permanent" />
    </rule>
    <rule name="Rewrite" 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="{R:1}.aspx" />
    </rule>
  </rules>
</rewrite>

这篇关于IIS URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆