Home > Blockchain >  setting 404 page displays the name of 404 file
setting 404 page displays the name of 404 file

Time:03-27

I edited the .htaccess file on my site, and added the line

ErrorDocument 404 page-not-found.html

So when I put in example.com/pagethatdoesntexist, the screen just displays "page-not-found.html". Why does this happen?

CodePudding user response:

As per Apache reference documentation, URLs can begin with a slash (/) for local web-paths (relative to the DocumentRoot), or be a full URL which the client can resolve.

So in your case, this should do the job.

ErrorDocument 404 /page-not-found.html

With no /, your webpage name will be treated as a message and printed in the browser.

  • Related