将所有文件请求重写到子文件夹

时间:2018-10-14 16:19:38

标签: asp.net iis url-rewriting url-rewrite-module

我想将所有文件请求(.js,.css等)重写到子文件夹,并将其他请求重写到dist/200.html。我无法匹配文件请求。

<add input="{REQUEST_FILENAME}" matchType="IsFile" />只能用于否定条件吗?

<rule name="Routes" stopProcessing="true">
    <match url=".*" />
     <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    </conditions
    <action type="Rewrite" url="dist/200.html" />
</rule> 

<rule name="Files" stopProcessing="true">
  <match url="(.*)" />
  <conditions>
    <add input="{REQUEST_FILENAME}" matchType="IsFile" />
  </conditions>
  <action type="Rewrite" url="dist/{R:1}" />
</rule> 

0 个答案:

没有答案