I have a .htaccess
file in the root directory and also 404.php file there. Content of my .htaccess
file is:
ErrorDocument 404 /404.php
But when I am mis-spelling my url, 404.php
is not opening. Instead I am getting following message:
Not Found
The requested URL /mywebsite/ites.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
But when I tried ErrorDocument 404 google.com
, it worked.
Where is your 404.php
actually located in relation to your .htaccess
file? Can you simply run it as a direct URL? Is the file readable by the server? Or is it in a nested subdirectory? You can also try the full URL as well:
ErrorDocument 404 http://mygreat.server/404.php
Full details in the official Apache documentation here.