title: IIS url rewrite, broken href (css, js etc)
body: <p>I am using IIS url rewriting module in asp.net application, my problem is any internal relative references like js, css, images are now pointing to wrong url after this url rewrite, below is my rewriting rule</p>
  
  <pre><code>&lt;rewrite&gt;
        &lt;rules&gt;
           &lt;rule name="pk" patternSyntax="ECMAScript"&gt;
            &lt;match url="pk/([a-z]+).aspx" /&gt;
            &lt;action type="Rewrite" url="{R:1}.aspx?mid=1" /&gt;
            &lt;conditions logicalGrouping="MatchAny"&gt;
              &lt;add input="{REQUEST_FILENAME}" pattern="(\.css|\.js)$" negate="true" /&gt;
            &lt;/conditions&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
  &lt;/rewrite&gt;
  </code></pre>
  
  <p>In above rewrite any url with "pk/page_name.aspx" is being translated to page_name.aspx?mid=1, this is working fine, however references to js,css and images in master page are now also pointing to "pk/files/js/jquery.js" while in my application it should be "files/js/jquery.js", Please help me solve this issue.</p>