troubleshooting Question

IIS7 URL rewrite map to other external domain

Avatar of Rovi31
Rovi31Flag for Netherlands asked on
Microsoft IIS Web ServerASP.NET
1 Comment1 Solution2252 ViewsLast Modified:
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>


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

Thanks.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros