RewriteRule ^/web/(.*) /web/$1 [P,L] 应该用这个。 你的 jk配置已经有了端口的设置,默认是8009,记得不是8080之类的。可以参考我的一个文章 Apache 2.2 + Tomcat 使用UrlRewrite实现泛域名解析的尝试

解决方案 »

  1.   

    先不要重写。先保证你的 .jsp能访问了。再用rewrite 进行改写
      

  2.   

    谢谢 老紫竹 的回答,估计你的办法也可以。昨晚凌晨终于解决了。找到原因了,在server.xml中自动生成的mod_jk.conf文件是根据 Host 节点的 appBase 属性的目录结构生成的JkMount ,但这样就出现问题了。如果 java程序采用url重写技术 制作的话,那么自动生成的文件就是错误的。最终我手写了一个配置文件,然后用命令 service httpd restart 重启 apache。 everything is ok.至于多站点,有必要说的是,默认 VisualHostName:80 是被注释掉的。去掉注释后,在/etc/httpd/conf/httpd.conf
    中增加 VisualHost 节点就ok 了。
    关键参照了下方的文章:(抱怨一下,官网的br解析有问题,眼睛都看瞎才注意到。)
    http://www.liferay.com/web/guest/community/forums/-/message_boards/message/65880#_19_message_65864I use mod_jk (mod_jk2 has been depracated) but here is the relavant parts of the file
    JkMount /c/* worker1
    JkMount /c worker1
    JkMount /web/* worker1
    JkMount /web worker1
    JkMount /applets/* worker1
    JkMount /image/* worker1
    JkMount /jcvs/* worker1
    JkMount /html/* worker1
    JkMount /laszlo/* worker1you need to add the entries for /web and\or /web/* since that is where the guest account redirects to. This confiuration is working for me.FYI
    If you hot deploy themes, you have to add an entry for every theme alsoPS - I see you are running Debian, mod_jk is libapache2-mod-jk - Apache 2 connector for the Tomcat Java servlet engine