You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sa...@twinix.com on 2007/09/09 21:15:03 UTC

Generating a 404 response

See Thread at: http://www.techienuggets.com/Detail?tx=12338 Posted on behalf of a User

I have a J2EE application residing on Tomcat. The pages are dynamically generated. If a use enters an invalid request I redirect him to a generic error page (which isn't really an error page but just a jsp that display a message and allows a redirect back to the site's main page). I would like to return a status of 404 from this page but because the page gets served properly I am returning a status of 200. The problem with this is that my error page than gets indexed by search engines. Any advise on how to tackle this?

TIA



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Generating a 404 response

Posted by Paul Singleton <pa...@jbgb.com>.
samk@twinix.com wrote:
> See Thread at: http://www.techienuggets.com/Detail?tx=12338 Posted on behalf of a User
> 
> I have a J2EE application residing on Tomcat. The pages are dynamically generated. If a use enters an invalid request I redirect him to a generic error page (which isn't really an error page but just a jsp that display a message and allows a redirect back to the site's main page). I would like to return a status of 404 from this page but because the page gets served properly I am returning a status of 200. The problem with this is that my error page than gets indexed by search engines. Any advise on how to tackle this?

Servlet docs suggest you can nominate your JSP as an
error page for status 404 - in Tomcat you could put
this in conf/web.xml (after <welcome-file-list>)

   <error-page>
     <error-code>404</error-code>
     <location>/my_error_404.jsp</location>
  </error-page>

then if you call response.sendError(404, "") when your
app decides the request isn't sensible, this page will
be used.  I haven't tried this.

Paul Singleton


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Generating a 404 response

Posted by Martin Gainty <mg...@hotmail.com>.
Sam-

How is your custom error page being indexed?

M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: <sa...@twinix.com>
To: <us...@tomcat.apache.org>
Sent: Sunday, September 09, 2007 3:15 PM
Subject: Generating a 404 response


> See Thread at: http://www.techienuggets.com/Detail?tx=12338 Posted on 
> behalf of a User
>
> I have a J2EE application residing on Tomcat. The pages are dynamically 
> generated. If a use enters an invalid request I redirect him to a generic 
> error page (which isn't really an error page but just a jsp that display a 
> message and allows a redirect back to the site's main page). I would like 
> to return a status of 404 from this page but because the page gets served 
> properly I am returning a status of 200. The problem with this is that my 
> error page than gets indexed by search engines. Any advise on how to 
> tackle this?
>
> TIA
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org