Redirect 重定向index.html
我有一个Struts 2应用程序。我们正在让许多用户访问index.html URL。我想改变他们的方向。我的想法是从URL中删除'index.html'并重定向到该目录(即example.com/some/dir/index.html=>example.com/some/dir/)Redirect 重定向index.html,redirect,struts2,Redirect,Struts2,我有一个Struts 2应用程序。我们正在让许多用户访问index.html URL。我想改变他们的方向。我的想法是从URL中删除'index.html'并重定向到该目录(即example.com/some/dir/index.html=>example.com/some/dir/) 我猜在struts.xml中有一种简单的方法可以做到这一点。我不确定您在寻找什么,但听起来您可能想要一个默认操作的解决方案?还是欢迎文件设置 <package name="restful" extends=
我猜在struts.xml中有一种简单的方法可以做到这一点。我不确定您在寻找什么,但听起来您可能想要一个默认操作的解决方案?还是欢迎文件设置
<package name="restful" extends="struts-default">
<!-- YOUR ACTIONS HERE -->
<default-action-ref name="default" />
<action name="default">
<result type="redirectAction">home</result>
</action>
</package>
家
或
index.jsp
或者在您的web.xml中,我可以将一个操作设置为欢迎文件:
<welcome-file-list>
<welcome-file>home</welcome-file>
</welcome-file-list>
家
这样做的目的是什么?我不确定你想要什么,但是你可以创建一个名为index.html的操作,从那里你可以使用forward,chain,但是它不会改变URL。如果您希望在一致的基础上执行此操作,那么URL重写可能是一个更好的解决方案,在linux上我会使用iptables,在apache mod rewrite上。。。有很多选择,只是谷歌的url重写,并决定这是否是你想要的。
<welcome-file-list>
<welcome-file>home</welcome-file>
</welcome-file-list>