2015-10-15 171 views
0

我有很多领域的IIS服务器多宿主。我对seo友好的URL有基本的重写规则。IIS URL重写与.htm没有传递到重写

实施例:

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

电流转换为

www.something.com/index.htm?pagetitle=here -is页式

问题是,一个域需要这种规则允许的URL与上月底的.htm读取。

例子:

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

需要转换为

www.something.com/index.htm? PAGETITLE =在这里,是最页

(注意,只是删除了的.htm,但我仍然希望的.htm在位置栏中显示)...

下面

回答

0

谢谢大家对所有的援助...... [讽刺]是解决方案。 这里的关键是MatchAll。

看的URL

检查,看看这是www.something.com

检查,以确保没有与filename.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>