Changing the page by defaul when I get an error “404 - file not found”

Hi everybody,

I would like to know how to Change the page by defaul when I get a error “404 - file not found” by my page “error404.html”. . . .

I have done the folow;

this tag is added in workspace\myproyec\deploy\tomcat\conf\web.xml:


on the hand create the error404.html in the root workspace\myproyec\deploy\tomcat\webapps\app

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>my  page error 404</title>
           my html page when get a error 404

According to the tomcat documentation, it should open my page error404.html when I get a error 404 but unfortunately when I get this error it doesn´t redirects to my page error404.html. . . . . please somebody can tell me if I have wronged or how I can do it???

thank a lot!!!


You need to place the error404.html file in the ROOT directory.


Hi Gleb, thank for your awner,

could you tell me where the root will be in my proyect?

I´ve just tryed to the page error404.html in the ROOT , myproyec\deploy\tomcat\webapps but it´s not working!


For your convenience take a look at the demo project (73.7 KB). Check the following files:

  • deploy/tomcat/conf/web.xml
  • deploy/tomcat/webapps/ROOT/error404.html


Hi Gleb,

I have had a look to the demo proyect that you send me and I don´t find the file error404.html in deploy/tomcat/webapps/ROOT/error404.html . . . . maybe you wronged when send me the file??



You’re right, the archive doesn’t contain the tomcat directory. Sorry about that. Simply add the ROOT directory within webapps and add error404.html within it.


Hi Gleb, my problem is over, you example help me a lot, appreciate it!!