Avatar of Rovi31
Flag for Netherlands asked on

IIS7 URL rewrite map to other external domain

I have a website in which the map "/img" must be redirected to another domain. The other domain can be an external one.

so "http://www.mydomain.com/img/test/demo.jpg" must be redirected to "http://www.otherdomain.com/img/test/demo.jpg"

i also have a <base href="http://www.mydomain.com/">, so the URL to be redirected will be most of the time "img/test/demo.jpg ", which then also should be redirected to to "http://www.otherdomain.com/img/test/demo.jpg"

i currently have this, but it doesn't work

     <rule name="Change image linking" stopProcessing="false">  
        <match url=".*\.(gif|jpg|png)$" />  
             <add input="{HTTP_HOST}" pattern="img/(.*)$" />  
      <action type="Redirect" url="http://www.otherdomain.com/{C:1}" appendQueryString="false" redirectType="Permanent" />  

Open in new window

How can i do that (in the web.config)

Microsoft IIS Web ServerASP.NET

Avatar of undefined
Last Comment
Steve Bink

8/22/2022 - Mon
Steve Bink

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy