Each server can handle himself back page (and thus the return code) if resource not found. For httpd, it is the directive DocumentError taking two parameters (error code Treaty and the page is allocated to them) (for example):
Code:
DocumentError 404 / 404.html
And tomcat xml block: view sourceprint?
Code:
<error-page>
<error-code> 404 </error-code>
<Rental> / 404.jsp </rental>
</error-page>
The problem with these two application servers is the need to unify the "Pages 404". There are several possibilities:
- Use two separate pages, one for httpd and another for tomcat
The problem with this solution is that there are 2 pages maintained in the event of change by example graphic
- Use an HTML page for the 2 application servers
If one uses a simple HTML page, you lose the power of Java and therefore the possibility to customize the error page
- Using a JSP for both httpd and tomcat
By specifying a JSP page to httpd, if resource not found error, this page will be well produced. However, there remains a problem: for example, calling the page 404.jsp, tomcat will review this page (existing) but also produce a return code 200 (OK resource) which is a problem for search engines (like google ). The only solution was satisfactory to produce a customized error page while returning the correct return code (404) is set to httpd error page JSP, inextistante.
For example, for httpd :
DocumentError 404 / # page404Inexistante.jsp Page not found
and tomcat :
Code:
<error-page>
<error-code> 404 </error-code>
<Rental> / 404.jsp </rental> <! - existing page ->
</error-page>
So, when applying for a static resource does not exist, httpd will try to produce a JSP page does not exist in tomcat who will turn over in producing the correct error page by producing the correct error code.
Bookmarks