.htaccess:
ErrorDocument 404 /404.php
404.php:
<?php
header('Content-Type: text/plain; charset="UTF-8');
print_r($_SERVER);
request:
localhost/test/dshgsdgsdhbshjdfh
output:
Array
(
[REDIRECT_REQUEST_METHOD] => GET
[REDIRECT_STATUS] => 404
....
[HTTP_REFERER] => http://localhost/test.html
[REDIRECT_URL] => /test/dshgsdgsdhbshjdfh
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /test/dshgsdgsdhbshjdfh
[SCRIPT_NAME] => /404.php
[PHP_SELF] => /404.php
[REQUEST_TIME_FLOAT] => 1375894390.798
[REQUEST_TIME] => 1375894390
[argv] => Array
(
)
[argc] => 0
)
Как видим, и реферер и путь, который «не найден» есть. Или я вас не понял?