Link to home
Start Free TrialLog in
Avatar of Rovi31
Rovi31Flag 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


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

Open in new window



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

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial