Iis 子目录到子目录URLEWRITE(使用文件名)

Iis 子目录到子目录URLEWRITE(使用文件名),iis,url-rewriting,web-config,url-rewrite-module,Iis,Url Rewriting,Web Config,Url Rewrite Module,我正在尝试重写所有请求,例如从/img/logo.svg转到/dist/img/logo.svg 有什么想法吗?我相信这是显而易见的 <rule name="RewriteImgFolder" stopProcessing="true"> <match url="^/img/(.*)" /> <action type="Rewrite" url="/dist/img/{R:1}" /> </rule> 如果

我正在尝试重写所有请求,例如从/img/logo.svg转到/dist/img/logo.svg

有什么想法吗?我相信这是显而易见的

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

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

您可以删除匹配url中的“/”

更多详细信息,您可以参考以下规则:

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