【问题标题】:Subdirectory to subdirectory UrlRewrite with filename子目录到子目录 UrlRewrite 与文件名
【发布时间】:2020-05-01 10:17:39
【问题描述】:

我正在尝试重写来自例如 /img/logo.svg 的所有请求以转到 /dist/img/logo.svg

有什么想法吗?我敢肯定这是显而易见的。

    <rule name="RewriteImgFolder" stopProcessing="true">
      <match url="^/img/(.*)" />
      <action type="Rewrite" url="/dist/img/{R:1}" />
    </rule>

【问题讨论】:

    标签: iis url-rewriting web-config url-rewrite-module


    【解决方案1】:

    如果您的网址是http://localhost/img/logo.svg,您的网址重写规则将不起作用。

    您可以删除匹配网址中的“/”。

    更多细节,你可以参考以下规则:

    <rule name="RewriteImgFolder" stopProcessing="true">
      <match url="^img/(.*)" />
      <action type="Rewrite" url="/dist/img/{R:1}" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-04
      • 1970-01-01
      • 2011-05-23
      • 1970-01-01
      • 2014-06-06
      • 1970-01-01
      • 2020-04-21
      相关资源
      最近更新 更多