ImageResizer web.config rewrite rule not working properly

雨燕双飞 提交于 2019-12-11 14:34:36

问题


I am using ImageResizer to read images from my Amazon S3, with this rule it is working great:

<rewrite>
    <rules>
      <rule name="Rewrite to s3" stopProcessing="true">
        <match url="^(.*)/(productimages)/(.*)" />
        <action type="Rewrite" url="{R:1}/mybucketname/{R:3}" appendQueryString="true" redirectType="Found" />
      </rule>
    </rules>
  </rewrite>

For this URL:

http://localhost:7514/s3/productimages/112/0718877-21_lg.jpg

Loads this image form Amazon S3:

http://localhost:7514/s3/mybucketname/112/0718877-21_lg.jpg

Everything is working BUT I need to get rid of the /s3 in the first URL, so it would be:

http://localhost:7514/productimages/112/0718877-21_lg.jpg

I have tried a million different combinations and I cannot get it.


回答1:


Without knowing what you've tried, it's a bit difficult to help.

Have you tried something like this?

<rewrite>
    <rules>
      <rule name="Rewrite to s3" stopProcessing="true">
        <match url="^productimages/(.*)" />
        <action type="Rewrite" url="s3/mybucketname/{R:1}" appendQueryString="true" redirectType="Found" />
      </rule>
    </rules>
  </rewrite>


来源:https://stackoverflow.com/questions/22592327/imageresizer-web-config-rewrite-rule-not-working-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!