IIS URL重写以不将.htm传递到重写中

IIS URL重写以不将.htm传递到重写中,iis,url-rewriting,iis-7.5,Iis,Url Rewriting,Iis 7.5,我有一个IIS服务器,有多个域。我有seo友好URL的基本重写规则 例如: www.something.com/here-is-the-page 电流转换为 www.something.com/index.htm?pagetitle=这是页面 问题是有一个域需要这个规则来允许URL以.htm结尾读取 例如: www.something.com/here-is-the-page.htm 需要转换为 www.something.com/index.htm?pagetitle=这是页面 (注意,刚刚删

我有一个IIS服务器,有多个域。我有seo友好URL的基本重写规则

例如:

www.something.com/here-is-the-page

电流转换为

www.something.com/index.htm?pagetitle=这是页面

问题是有一个域需要这个规则来允许URL以.htm结尾读取

例如:

www.something.com/here-is-the-page.htm

需要转换为

www.something.com/index.htm?pagetitle=这是页面


(注意,刚刚删除了.htm,尽管我仍然希望.htm显示在位置栏中).

谢谢大家的帮助…[讽刺]下面是解决方案。 这里的关键是火柴

看看网址

检查一下这是否是为www.something.com准备的

检查以确保没有文件名为.htm的实际文件

检查是否没有具有该名称的目录

如果文件是sitemap.htm(该文件确实存在,则不要处理),则应在上一次检查文件时捕获该文件,但刚刚添加该文件是为了防止过度使用。由于这是一次重写而不是重定向,因此.htm仍将显示在导航栏中

<rule name="remove the htm" stopProcessing="true">
  <match url="([_0-9a-z-]+)\.htm$" />
  <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
    <add input="{HTTP_HOST}" pattern="^(www.something.com)$" />
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    <add input="{REQUEST_FILENAME}" pattern="sitemap\.htm$" negate="true" />
  </conditions>
  <action type="Rewrite" url="/index.cfm?pagetitle={R:1}" />
</rule>