Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your apparent file structure:</p> <pre><code>/ .htaccess request.php ... errors/ junk.php </code></pre> <p>.htaccess</p> <pre><code>ErrorDocument 404 /errors/junk.php </code></pre> <p>request.php</p> <pre><code>header('HTTP/1.1 404 Not Found', true, 404); echo "Despite the 404 header this ~file~ actually exists as far as Apache is concerned."; exit; </code></pre> <p>errors/junk.php</p> <pre><code>header('HTTP/1.1 404 Not Found', true, 404); echo "The file you're looking for ~does not~ exist."; echo "&lt;pre&gt;" . var_export($_SERVER, TRUE) . "&lt;/pre&gt;"; exit; </code></pre> <p><a href="http://yoursite.com/request.php" rel="nofollow">http://yoursite.com/request.php</a> will show:</p> <blockquote> <p>Despite the 404 header this ~file~ actually exists as far as Apache is concerned.</p> </blockquote> <p><a href="http://yoursite.com/filethatdoesntexist.php" rel="nofollow">http://yoursite.com/filethatdoesntexist.php</a> will show:</p> <blockquote> <p>The file you're looking for ~does not~ exist.</p> <p>[a dump of $_SERVER which may be helpful in writing custom 404 handler code]</p> </blockquote> <p>If you have a file that exists, but you want it to pretend it's a 404 you can either write the redirect in PHP as:</p> <pre><code>header('Location: http://mysite.com/errors/junk.php'); exit; </code></pre> <p>Which will redirect the browser to the full URL, or simply:</p> <pre><code>include('errors/junk.php'); exit; </code></pre> <p>Which will leave the user at the same page URL, but present your error code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload