2010-07-22 51 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>