title: URL Rewrite rule for IIS to replace folder path in everypage
body: <p>We are having more than 300 pages in my website project. Over the time we have created a new server which is secure. This server is specially used for all the images in website.</p>
  
  <p>So here is the scenario:</p>
  
  <ul>
  <li><p>current implementation for images ( in aspx, in css )</p>
  
  <pre><code>http://www.mysite.com/assets/common/image1.jpg
  </code></pre></li>
  <li><p>sometimes in webpage and css it is specified like this</p>
  
  <pre><code>~/assets/common/image1.jpg        
  </code></pre></li>
  <li><p>would like to use somethig like this.</p>
  
  <pre><code>http://www.static.mysite.com/common/image1.jpg
  </code></pre></li>
  <li><p>and for secure pages </p>
  
  <pre><code>https://www.static.mysite.com/common/image1.jpg
  </code></pre></li>
  </ul>
  
  <p>So as you can see all the images are coming from <code>~/assets</code> folder BUT now I want to create a rule replacing <code>~/assets</code> with <code>http://static.mysite.com</code></p>
  
  <p>How can I achieve this in IIS using rewrite rule.</p>
  
  <h1>EXAMPLE:</h1>
  
  <h1>ASPX</h1>
  
  <pre><code> &lt;img src="/assets/common/image1.jpg" id="ImageId1" alt="Image" width="100" height="100" /&gt;
  
  &lt;img src="http://mysite.com/assets/common/image2.jpg" id="ImageId2" alt="Image" width="100" height="100" /&gt;
  </code></pre>
  
  <p>Would like to have IIS rule, when finds above code, replace it with <a href="http://static.mysite.com/common/image1.jpg" rel="noreferrer">http://static.mysite.com/common/image1.jpg</a></p>
  
  <pre><code> &lt;img src="http://static.mysite.com/common/image1.jpg" id="ImageId1" alt="Image" width="100" height="100" /&gt;
  
  
  &lt;img src="http://static.mysite.com/common/image2.jpg" id="ImageId2" alt="Image" width="100" height="100" /&gt;
  </code></pre>