2015-10-15 168 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>