Tomcat 5.5中的永久301重定向 [英] permanent 301 redirect in Tomcat 5.5
本文介绍了Tomcat 5.5中的永久301重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以独立运行Tomcat 5.5(而不是在IIS/Apache之后)进行301重定向?
Is it possible to do 301 redirect with Tomcat 5.5 running standalone, not behind IIS/Apache?
推荐答案
没有一种方法可以像使用Apache一样容易地进行设置.最接近的事情是使servlet或jsp处理重定向,然后将其映射到您要重定向的URL.在servlet或jsp中,它将执行以下操作:
There isn't a way to set this up as easily as you're able to with Apache. The closest thing would be to make a servlet or jsp to handle the redirect and then map it to the URL you want to redirect from. In the servlet or jsp it would do something like:
response.setStatus(301);
response.setHeader("Location", "http://www.example.com/redirect-to-here.html" );
这篇关于Tomcat 5.5中的永久301重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文