MOD改写明确的主页网址为Tomcat + APACHE [英] mod rewrite clear home url for tomcat + apache

查看:185
本文介绍了MOD改写明确的主页网址为Tomcat + APACHE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对通过MOD-JK Tomcat的Apache的前端运行的支柱应用程序。

I have a struts app running on Apache front end of Tomcat via mod-jk.

我想使用mod-rewrite清除某​​些动作的URL生成由支柱。

I am trying to use mod-rewrite to clean some of the action urls generate by struts.

示例:改写(正常工作)

http://www.demo.com/context/user.do?action=aboutus HTTP://www.demo。 COM /环境/关于我们使用
重写规则^ / MSN /关于我们$ /msn/user.do?action=aboutus [PT,L]

问题:我想重写 http://www.demo.com/context/user.do?action=home http://www.demo.com (主页)

我试过这个
重写规则^ / $ /环境/ userdo?行动=家[PT,L] 这是行不通的。

I tried this RewriteRule ^/$ /context/userdo?action=home [PT,L] which does not work.

仅供参考

所有CSS,JS和链接是相对路径。

All the css,js and links are on relative path.

DirectoryIndex的是对的index.html(它是否在改变mod-rewrite的行为吗?)

DirectoryIndex is on index.html (Does it change mod-rewrite behaviour?)

Tomcat的5.5版,通过应用在的public_html /背景爆炸WAR文件部署/ 文件夹(多种部署)

Tomcat Version 5.5, Application deploy via exploding the WAR file in public_html/context/ folder (multiple deployment)

URLrewrite过滤器不利于按照以消除上下文名称<一个href=\"http://stackoverflow.com/questions/8556407/urlrewritefilter-how-to-remove-the-context-folder-name\">this.

URLrewrite filter does not help to remove the context name according to this.

日志

我累了看看日志文件(快照)不给出任何提示错误信息。

I tired to have a look at the log file (snapshots) which doesn't give any warning error messages.

(3) applying pattern '^/$' to uri '/context/jsps/images/abc.png'
(3) applying pattern '^/abc/aboutus$' to uri '/abc/jsps/images/abc.png'   
(3) applying pattern '^/abc/home$' to uri
'/abc/jsps/images/abc.png'

任何人都可以给我一些想法是什么出了问题?我怎么能解决这个问题?

Anyone can give me some ideas what went wrong? and how can I solve that issue?

推荐答案

我觉得在你重写的情况下, ^ / $ 这是正在precedence的mod_jk在mod_rewrite的规则,因为使用的mod_jk你要转发一切例如: / * 来自Apache Tomcat的。我会建议使用 URLRewriteFilter Tomcat的应用程序中实现这些URL重写正常。

I think in your case of rewriting ^/$ it is mod_jk that is taking precedence over mod_rewrite rules since using mod_jk you are forwarding everything eg: /* to Tomcat from Apache. I will suggest using URLRewriteFilter within your Tomcat app to achieve these URL rewrites properly.

这篇关于MOD改写明确的主页网址为Tomcat + APACHE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆