Hi,

I wonder how I could achieve that Tomcat sends a 301 (permanent redirect) 
instead of 302 (temporary redirect) when a directory is requested without a 
trailing slash.

Currently, when Tomcat receives a request like
http://<domain>/some-directory<http://%3cdomain%3e/some-directory>
it redirects to
http://<domain>/some-directory/<http://%3cdomain%3e/some-directory/>
adding the missing trailing slash.

Apparently the redirect is executed either by the mapper or the DefaultServlet, 
depending on the "mapperDirectoryRedirectEnabled" property in the context.
Either way, I would like to have a 301 instead of 302 for SEO reasons.

How can I do this?
Already considered subclassing the Default Servlet but the redirect is in a 
private method..
Do I have to write a Valve?

Many thanks for pointing me in the right direction!

Benny

Reply via email to