Using server variables in .htaccess error text
<p>Is there a way in .htaccess to use <code>%{REQUEST_URI}</code> in the <code>ErrorDocument</code> thingy? Because I can't redirect using <code>ErrorDocument</code> and I want the url to stay the same (in the url bar like <code>example.com/thispagedoesnotexist</code> instead of <code>example.com/404</code>).</p>

<p>Because everyone nowadays uses <code>ErrorDocument 404 http://example.com/404</code>
(or similar) and in the /404 file they use something like <code>echo $_SERVER['REQUEST_URI'];</code></p>

<p>But my host does not allow that so I have to use "plain" text error messages<br>
<code>ErrorDocument 404 "&lt;h1&gt;The requested page could not be found.&lt;/h1&gt;"</code></p>

<p>So I thought I could use server variables to represent the PHP code, but I can't get it to work, or is it not possible?
Because <code>ErrorDocument 404 "&lt;h1&gt;The requested page %{REQUEST_URI} could not be found.&lt;/h1&gt;"</code> does not work.</p>

<h2>Update:</h2>

<hr>

<p>My .htaccess looks like this  </p>

<pre><code>RewriteEngine On

Options -Indexes 

RewriteRule ^admin/login$ /admin/user/userLogin.php
RewriteRule ^admin/logout$ /admin/user/userLogout.php

# this works \/
ErrorDocument 404 "&lt;h1&gt;Page not found&lt;/h1&gt;"
# and this throws an 500
ErrorDocument 404 /404.php
</code></pre>

<p>The 500 error looks like this  </p>

<pre><code>Internal Server Error

The server encountered an internal error or misconfiguration and  
was unable to complete your request.

Please contact the server administrator, webmaster@mydomain.com and
inform them of the time the error occurred, and anything you might 
have done that may have caused the error.

More information about this error may be available in the server error log.
</code></pre>