2

I have 1000 static html page files and html data in Database. Now i want to move to amazon s3 server, i will move all of my static files to s3. How i can route the path to the new location, i can't update all of the pages and correct images path. like:

<img src='/myfiles/images/blog/20140606/flow.jpg'/>    

to

Request: /myfiles/images/blog/20140606/flow.jpg
Redirect to: htps://xxx.s3.amazonaws.com/myfiles/images/blog/20140606/flow.jpg

i need a route to redirect the request to new location instead of update all files.

mehr
  • 845
  • 1
  • 9
  • 18

1 Answers1

3

May be using a url rewrite in your web.config like this:

<rewrite>
    <rules>
      <rule name="Rewrite to s3" stopProcessing="true">
        <match url="^/myfiles/images/blog/(.*)" />
        <action type="Rewrite" url="s3/mybucketname/{R:1}" appendQueryString="false" redirectType="Found" />
      </rule>
    </rules>
  </rewrite>
Amr Elgarhy
  • 66,568
  • 69
  • 184
  • 301
  • 2
    Yes you can, and About the {R:x} {R:x} is used as back reference from the rule pattern (). and you find more about there: http://stackoverflow.com/questions/16998832/iis-url-rewrite-rn-clarification – Amr Elgarhy Oct 28 '14 at 12:02