So I am trying to do a redirect rule using IIS Rewrite URL 2.0; basically if a user hits original site:http://www.originalsite.com/2013REIT/images/header.jpg I want to redirect to http://static.domain.net/images/2013REIT/images/header.jpg
Testing the regex works, but when I rewrite using the below rule I end up redirecting to http://static.domain.net/images/images/header.jpg instead of maintaining the original path "2013REIT/Images" path. Any ideas?
Thanks in advance!
<rule name="Rewrite image files" stopProcessing="true">
<match url="^(http(s)?(:\/\/))?(www\.)?[a-zA-Z0-9-_\.]+/(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="\.(gif|jpeg|jpg|png|bmp|pn|psd|tif|tiff|svg)" />
</conditions>
<action type="Redirect" url="http://static.domain.net/images/{R:5}" appendQueryString="false" />
</rule>