The first problem is solved, the second one remains: Added in 404.php: echo $_SERVER["HTTP_REFERER"]; however, echo does not output anything.

How to get the address of a non-existent file to display it at 404.php?

Content .htaccess :

 # ErrorDocument 404 /404.html # DirectoryIndex index.php index.html # Options -Indexes 
  • worth showing htaccess - SeVlad
  • Added, but it is very simple ... - Alexan-Dwer
  • And the file '404.html' is in the root? Does it open in a browser? (and index.cgi should be removed if not used) - SeVlad
  • Yes, ErrorDocument 403 /404.html for example works - Alexan-Dwer
  • And here 403? httr // website.ru / 404.html - shows the contents of this page (404.html)? - SeVlad

1 answer 1

Rule in .htaccess :

 ... ErrorDocument 404 /404.php 

File 404.php :

 <?php // $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; // echo $url; ?> 

PS If for professionals at Stack Overflow they find the question too simple, I note that searching it did not give much information. Perhaps the answer is too obvious, but he did not immediately come to my mind ...