title: How to log WHAT was not found on error 404 with PHP
body: <p>Excuse me if this question is on the wrong community. If this is treu, where do I post this question. I can not find any answer to this.</p>
  <p>I'm trying to capture and record to a file, WHICH page/file the user provided in the link and was not found, and therefore called 404 error page.</p>
  <p>Example, if someone types &quot;http://example.com/indx.html&quot; by wrong typing index, then Apache/Nginx will show the 404 error page.
  If I define <code>ErrorDocument 404 /errosHtml/php404.php</code> in <code>.htaccess</code>, the page php404.php will be displayed.</p>
  <p>How can I identify, in <code>php404.php</code>, which page was requested and not found.
  I would like to log this to a file and also show the error to the user. For example:
  <code>&lt;p&gt;The file [indx.html] does not exist on this server. Did you type it wrong?</code></p>
  <p>I tried the <code>$_SERVER['REQUEST_URI']</code> variable, but it shows <code>php404.php</code>.</p>
  <p>I googled a lot, but there was no response for this.</p>
  <p>Thanks in advance.</p>
  <p>Best</p>