title: IIS7 rewrite for REST not working
body: <p>I have a REST service and am trying to remove the .svc - a common task/problem.</p>
  
  <p>The application on the server is in a virtual directory under the default website (not sure if this is important)</p>
  
  <p>I have installed the IIS Rewrite Module and have tried to create a rewrite rule for this.</p>
  
  <pre><code>http://blah.me.com/here/thingys/get?id=1111
  </code></pre>
  
  <p>to rewrite to this:</p>
  
  <pre><code>http://blah.me.com/service.svc/thingys/get?id=1111
  </code></pre>
  
  <p>In my web.conf the following is created:</p>
  
  <pre><code>&lt;rewrite&gt;
          &lt;rules&gt;
              &lt;rule name="GEAPI /here/ to /service.svc/"&gt;
                  &lt;match url="^(.*?)/here/(.*)$" /&gt;
                  &lt;action type="Rewrite" url="{R:1}/service.svc/{R:2}" /&gt;
              &lt;/rule&gt;
          &lt;/rules&gt;
      &lt;/rewrite&gt;
  </code></pre>
  
  <p>In the GUI the regular expression does test correctly.</p>
  
  <p>However - when I run this in a browser on the server, it gives the following 404 error:
  <br /><br /><b>
   Error Code 0x80070002<br /> 
   Requested URL <a href="http://blah.me.com:80/here/thingys/get?id=1111" rel="nofollow noreferrer">http://blah.me.com:80/here/thingys/get?id=1111</a><br /> 
   Physical Path C:\MyApp\here\thingys\get 
  </b>
  <br /><br />
  C:\Myapp is the correct physical directory the virtual directory in IIS is pointing to.
  <br /><br />
  Is there something I am missing here ? I have tried creating this rule under both the default website and the app, both separately and together.
  <br /><br />
  Big thanks</p>
  
  <p>P</p>