title: Web.config - Custom error pages not working
body: <p>I have tried the following (and also tried with the commented-out uncommented instead) but only get an error:</p>
  
  <blockquote>
    <p>The resource you are looking for has been removed, had its name
    changed, or is temporarily unavailable.</p>
  </blockquote>
  
  <p>In the web.config of a published website project:</p>
  
  <pre><code>  &lt;system.webServer&gt;
      &lt;httpErrors errorMode="Custom"  existingResponse="Replace"&gt;
        &lt;remove statusCode="404"/&gt;
        &lt;!--&lt;error statusCode="404" responseMode="File" path="\Error\404.htm"/&gt;--&gt;
        &lt;error statusCode="404" responseMode="ExecuteURL" path="http://example.com/Error/404.htm"/&gt;
      &lt;/httpErrors&gt;
    &lt;/system.webServer&gt;
  </code></pre>
  
  <p>I try it by changing the url in the browser from <code>.../default.aspx</code> (which is fine) to <code>.../abc.aspx</code>.</p>
  
  <p>Is this the correct way to redirect to error pages, or is there some mistake here?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've found that if I try <code>http://example.com/nonExistingPage</code> - it <em>does</em> redirect to the error page. But not from<code>http://example.com/Folder/nonExistingPage</code></p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>The problem was partially solved by specifying the path after <code>example.com</code>. However - the site is published to <code>example.com/subfolder</code> and when someone navigates to <code>example.com/nonExistingFolder</code> - the custom error page is not shown.</p>