2010-07-22 49 views
2

我想這樣做重寫URL在一個位置一堆靜態網頁的如果它存在的文件夾,使得重寫規則位置映射到靜態文件

/倫敦

映射到物理文件位置文件夾,例如。

/locations/london.aspx

這是可能的URL重寫。我無法使規則起作用。

<rule name="Rewrite Locations"> 
    <match url="^([_0-9a-z-]+)/*" /> 
     <conditions> 
      <add input="/locations/{REQUEST_FILENAME}.aspx" matchType="IsFile" /> 
     </conditions> 
     <action type="Rewrite" url="/locations/{R:1}.aspx" /> 
</rule> 

非常感謝,

伊恩

回答

0

對於ISFILE工作,你必須通過正確的物理路徑,而不是虛擬路徑,你可以這樣做:

<rule name="Locations" stopProcessing="true"> 
    <match url="^([_0-9a-z-]+)/*" /> 
    <conditions> 
     <add input="{APPL_PHYSICAL_PATH}locations\{R:1}.aspx" matchType="IsFile" /> 
    </conditions> 
    <action type="Rewrite" url="/locations/{R:1}.aspx" /> 
</rule>