title: Redirect to custom 404 error page with .htaccess when the site url is unknown
body: <p>I am using an .htaccess file to get user-friendly urls like: </p>
  
  <p>mysite/about</p>
  
  <p>mysite/articles/some_article
  etc.</p>
  
  <p>Everything works fine, but now I have to add to my .htaccess file a redirection to a custom 404-page:
  mysite/error-404</p>
  
  <p>For test purposes I did it this way:</p>
  
  <pre><code>ErrorDocument 404 http://mysite/error-404
  </code></pre>
  
  <p>and it works both on localhost and on a "live" test site.</p>
  
  <p>The problem is that I don't know what will be the site url or even if it will be in root folder or in a subfolder like </p>
  
  <pre><code>http://somesite/mysite
  </code></pre>
  
  <p>How can I rewrite the redirection to a 404-page to make it universal? Is it possible to get a full url of the site folder (whatever/mysite/) and to write the redirection like this:</p>
  
  <pre><code>ErrorDocument 404 {http://whatever/mysite/}error-404
  </code></pre>