Customized 404 Error Page Tomcat
Contents |
exist, a 404 Error is raised and the user is served Tomcat's default 404 error page as below: Above, I requested tomcat 7 404 error page a page called 'david' which does not exist. To make your 404 page apache tomcat 404 error page a bit more presentable, provide the user with a link back into your site, as well as hide 404 error in tomcat eclipse the Tomcat version in use, you can easily add a custom 404 error page. Start by creating the page you wish to use. In my case, I am creating a page tomcat 403 error called 'NotFound.jsp' Add the 404 page you crated to your site directory. Now, in your $CATALINA_HOME/conf directory, edit your web.xml file. Add the following entry just beneath the welcome-file-list entry as shown below:
Tomcat 500 Error
http://www.davidghedini.com/YadaYadaYada.jsp SEO Disclaimer: I've called my page NotFound.jsp page and have added a meta-tag: meta content="noindex" name="robots"> I did this as it (supposedly), the tag will stop search engined from indexing my 404 page. I'm not an SEO guy so whether this is necessary (or even a good idea), I don't know. You could, of course, place your 404 page within a sub directory (e.g. '404') and adjust the location in your web.xml from /404/NotFound.jsp to /NotFound.jsp. You could then add a robots.txt file to prevent crawling of the directory. Related Posts: Install Tomcat 6 on CentOS Tomcat Oracle JDBC Connection Tomcat Manager Password Posted by David Ghedini at 4:29 PM Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest Labels: 404 page, Tomcat No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) About David Ghedini View my complete profile LinkedIn Technorati Profile Blog Information Profile for DavidGhedini Blog Archive ► 2012 (1) ► July (1) ► 2011 (8) ► June (1) ► March (4) ► February (3) ▼ 2010 (11) ► December (2) ▼ October (2) Tomcat Custom 404
there are a lot of things you can change or tweak. 6.1. Disable Directory Listing For
Tomcat 400 Error
fresh Tomcat installations, directory listing is enabled by default. This web xml 404 error page can be a very useful debugging tool, and if, like me, you sometimes forget what servlets java 404 error are deployed in a certain web application, you can get a complete listing by simply keying in the web application's URL. But for production deployments, you http://davidghedini.blogspot.com/2010/10/tomcat-custom-404-page.html may want to turn it off. If nothing else, it discourages users from poking around where they should not. There are basically 2 methods of "turning off" this option : Create an index.html file and place it in the web application's directory Edit the global web.xml file to turn off the option. The http://linux-sxs.org/internet_serving/c581.html first option is fairly simple, so we shall only examine the second option. Open the file web.xml which is located inside $CATALINA_HOME/conf/. This is the global web.xml file, which means that any changes here will affect ALL web applications deployed by that Tomcat instance. If you want more granular control, like turning it off for certain applications but not for others, you will need to go with the first option of creating index.html files. Locate the following section:
Start here for a quick overview of the site Help Center Detailed answers to http://serverfault.com/questions/254102/custom-error-pages-on-apache-tomcat any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer 404 error site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Custom error pages on Apache Tomcat up vote 1 down vote favorite I'm running 404 error page an Apache Tomcat server with 2 custom servlets. The tree structure looks like: $CATALINA_HOME/webapps/ ROOT/ WEB-INF/ servlet1/ META-INF/ WEB-INF/ servlet2/ META-INF/ WEB-INF/ I am trying to add a custom error html page for each servlet that will be displayed on error 400, 404 and when there is an exception on the servlet (such as the information that was supposed to be sent to the servlet on the http request is not there) I added to $CATALINA_HOME/webapps/servlet1/WEB-INF/web.xml