-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Alexandre,
>>> On Apr 25, 2018, at 7:06 PM, Christopher Schultz >>> <ch...@christopherschultz.net> wrote: >>> >> Anexandre, >> >>>>> On 4/25/18 6:23 PM, Alexandre Adao wrote: What will be the >>>>> easiest way to customize page error 404 running Apache >>>>> Tomcat 9.0.6? I have tried some links such as >>>>> https://serverfault.com/questions/254102/custom-error-pages-on-apa che- >> >>>>> >>>>> tomcat >>>>> >>>>> >> and didn't work. >>>>> >>>>> I am running on Windows Server 2016 at the moment. My >>>>> default directory is: C:\Program Files\Apache Software >>>>> Foundation\Tomcat 9.0.6. Which web.xml needs to be >>>>> changed? ..\conf or ..\weapps ? How can I customize the >>>>> error page 404? >> >> Do you want to customize the 404 response page for your web >> application (e.g. /myapp/no-such-resource) or for the whole >> server (e.g. /no-such-context/no-such-resource)? > On 4/25/18 7:49 PM, Alexandre Adao wrote:> For the whole server... The easiest thing for you to do is: C:> CD C:\Program Files\Apache Software Foundation\Tomcat 9.0.6 C:> MKDIR webapps\ROOT C:> CD webapps\ROOT C:> MKDIR WEB-INF C:> COPY CON WEB-INF\web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" metadata-complete="true"> <display-name>Dummy ROOT context to prevent 400 Bad Request responses</display-name> <error-page> <error-code>404</error-code> <location>/404.html</location> </error-page> </web-app> ^Z <- That's a CTRL-Z character, to end the here-document Now, put whatever content you want into 404.html and you are done. If you like what you have, make it into a WAR file and you can drop it onto all your running servers. - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlrhzvIACgkQHPApP6U8 pFj9LA/+OhtekamX2nv4IfD+K8iYqqrLqpreL/sGumaQ8I+18+R5RUMXN13v0Nfs A3DZK8ASK9dThZtXg1HnHuFP+F3tFgk50Wt8NIg3CqbS+CI6ozljXjuogXI1vUlB 1ZdRdvAyB79F4k3h9CGPmh10BAuTohR4O1K8//NtW1Ca0JpOIS1ZDYTuj//XQA6N 4be37HOTGCh5+szp8E+wpM4DncHjlOB2AbtCTeNeTmb4KzoJuIYSlJxwWxXV58fc dRCi0di/uy2DnwS/3KNQp4dyk2qnnr9iwHcfopr+Vb24hvrH+7sLTSaydxZkfoxh lPY9KfD6asPjfrCZWeT9/scN+iQ4ELnpdB+e/FuQ9BNZQ/fIfSFBFnkpEeMw7qmF j2A76gViJO+RNhGmDF5kOjOlR9Wy2oYI7/7mnfiqS30SK56so5wZY0eEoF+0W3IE 1GvatccA2l2dJwQzAcEOcUzdrUPRNCK9omfvW0Qil8Rl0l7/h/v+jW72MdN+kZBY eEatVGdkrYw/qXG/QGc4lbpoe5/6HIzGZ7SmZH8ymoQR/+LyMwOFn5MrRn+dZTpV QGWddokaz0er3WU7pRRuhWRlHp1GPsYh5X7y2WnJ++R33G0ctksm6q1iCOx4utnr +yOVqQDhUjphEThWpQwostlj07ejY6wjS5+WjitDkAbB+sjCIxI= =ytZS -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org