[英]IIS/web.config Redirect folder to another host but not its sub directoy
我有两台服务器,一台用于开发,另一台用于生产。
通常会刷新本地环境的数据库,以便本地环境中显示的数据成为生产服务器的精确镜像。 但是,该数据库中引用的图像不是因为图像库太大。
我是否可以将图像重定向到生产服务器上的图像目录,但排除该目录中的任何子文件夹都无法重定向。
我需要能够使用web.config或IIS来执行此操作。
例如:
localhost/images/file.jpg | .gif | .png
重定向到
productionserver/images/file.jpg | .gif | .png
但排除
localhost/images/assets/
是的,您只需要正确设置正则表达式即可:
<rules>
<rule name="image redirect" stopProcessing="true">
<match url="^images/([^/]*)$" />
<action type="Redirect" url="productionserver/images/{R:1}" />
</rule>
</rules>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.