Forum Moderators: phranque
Using tomcat via Apache and...
I would like to send a useful page back to my users when they mistype a URL or go to a URL that is no longer in our system. But I want bots to know that the page is gone.
I have been sending 404's with a custom static page defined in the web.xml for Tomcat. But search engines don't seem to respond to 404s by removing content -- they keep trying and trying.
I could do the same thing with 410's I assume but what I really want is to send back a dynamic page (we can take a good guess at what they were looking for from the URL alone). Is there a way to send back a custom error page?
Thanks!
Really all you need to do is set the http status; and display the page as you would otherwise. This can be done using HttpServletResponse.setStatus() in Java. Browsers handle don't do anything special with a 410 -- they just display the page, which is exactly what I wanted.