S
Steven Hines
Hi all - am having trouble finding an answer to this question.
I'm running Tomcat 4.1.27 on Windows 2000 Server, and I would like to
know how to manually set the HTTP status code of a web page to 404.
Allow me to explain...
I have recently rebuilt my old website but the search engines (in
particular YahooSeeker from inktomisearch.com) are still trying to
index pages under the old URLs they have stored in their databases. I
have a default user-friendly error page that is served whenever a use
encounters a 404. The trouble is that, when the search engines request
an old page, they get the error page. The logs tell me that this error
page is being served with an HTTP status of 200 which means the search
engines think that it's a valid page. This means that they continually
try to index old pages that aren't there anymore.
How can I manually set the HTTP status code of my error page to always
be 404, yet still show the user-friendly page to normal browsers?
All ideas gratefully received!
Thanks in advance,
Steve
PS can anyone tell me why I get so many & characters in web log
entries such as this:
yj1035.inktomisearch.com - - [04/Feb/2004:11:25:33 +0000] "GET
/scripts/display.cgi?type=hotels&city=238&&&&&&&&&&&&&first=1&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&sort=alpha
HTTP/1.0" 200 8678 "-" "YahooSeeker/1.0 (compatible; Mozilla 4.0; MSIE
5.5; http://help.yahoo.com/help/us/shop/merchant/)"
---------
TECH INFO
---------
Here are some of the relevant entries from my web.xml file:
<servlet>
<servlet-name>errorDispatcher</servlet-name>
<servlet-class>com.ora.jsp.servlets.ErrorDispatcherServlet</servlet-class>
<init-param>
<param-name>errorPage</param-name>
<param-value>/error.jsp?debug=log</param-value>
</init-param>
</servlet>
<!-- The mapping for the servlet to handle run-time errors -->
<servlet-mapping>
<servlet-name>errorDispatcher</servlet-name>
<url-pattern>/errorDispatcher</url-pattern>
</servlet-mapping>
<!-- Error pages -->
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>400</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>401</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>405</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>408</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/errorDispatcher</location>
</error-page>
Also, my error page error.jsp contains the following:
<%@ page isErrorPage="true" %>
I'm running Tomcat 4.1.27 on Windows 2000 Server, and I would like to
know how to manually set the HTTP status code of a web page to 404.
Allow me to explain...
I have recently rebuilt my old website but the search engines (in
particular YahooSeeker from inktomisearch.com) are still trying to
index pages under the old URLs they have stored in their databases. I
have a default user-friendly error page that is served whenever a use
encounters a 404. The trouble is that, when the search engines request
an old page, they get the error page. The logs tell me that this error
page is being served with an HTTP status of 200 which means the search
engines think that it's a valid page. This means that they continually
try to index old pages that aren't there anymore.
How can I manually set the HTTP status code of my error page to always
be 404, yet still show the user-friendly page to normal browsers?
All ideas gratefully received!
Thanks in advance,
Steve
PS can anyone tell me why I get so many & characters in web log
entries such as this:
yj1035.inktomisearch.com - - [04/Feb/2004:11:25:33 +0000] "GET
/scripts/display.cgi?type=hotels&city=238&&&&&&&&&&&&&first=1&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&sort=alpha
HTTP/1.0" 200 8678 "-" "YahooSeeker/1.0 (compatible; Mozilla 4.0; MSIE
5.5; http://help.yahoo.com/help/us/shop/merchant/)"
---------
TECH INFO
---------
Here are some of the relevant entries from my web.xml file:
<servlet>
<servlet-name>errorDispatcher</servlet-name>
<servlet-class>com.ora.jsp.servlets.ErrorDispatcherServlet</servlet-class>
<init-param>
<param-name>errorPage</param-name>
<param-value>/error.jsp?debug=log</param-value>
</init-param>
</servlet>
<!-- The mapping for the servlet to handle run-time errors -->
<servlet-mapping>
<servlet-name>errorDispatcher</servlet-name>
<url-pattern>/errorDispatcher</url-pattern>
</servlet-mapping>
<!-- Error pages -->
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>400</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>401</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>405</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>408</error-code>
<location>/errorDispatcher</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/errorDispatcher</location>
</error-page>
Also, my error page error.jsp contains the following:
<%@ page isErrorPage="true" %>