0

Hi I am trying out apache htaccess for my site(not wordpress). I want to make custom 404 error so I add following in .htaccess file:

ErrorDocument 404 /404.php

My file structure is

/htdocs
       /some-dir
                /.htaccess
                /404.php

while I accessing any random URL I get the error:

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

MrWhite
  • 43,179
  • 8
  • 60
  • 84
  • Does this answer your question? [ErrorDocument 404 /404.php is not working in .htaccess file in PHP](https://stackoverflow.com/questions/22976772/errordocument-404-404-php-is-not-working-in-htaccess-file-in-php) – Noah Boegli Oct 07 '21 at 13:16

1 Answers1

1
ErrorDocument 404 /404.php

The ErrorDocument directive takes a document root-relative URL-path, so from your file structure this should presumably be:

ErrorDocument 404 /some-dir/404.php

Reference:

MrWhite
  • 43,179
  • 8
  • 60
  • 84