My problem is this: I have a JBoss 4.2.3 application server with an AJP 1.3 connector running on the same host under Windows (192.168.1.2 for my test environment) and Apache 2.2.14 running in another FreeBSD flag (192.168.1.10 )). Apache acts as the front gate for all requests and sends them to JBoss via mod_jk. Everything worked fine until I had to optimize SEO. These optimizations include SEF URLs, so I decided to use mod_rewrite for Apache to modify requests before sending them to JBoss. Basically, I failed to implement 2 rules:
Here is my Apache virtual host configurator:
<VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "/usr/local/www/dummy" ServerName 192.168.1.10 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule /directory/(.*) /$1 [R=permanent,L] RewriteRule ^/([^/]+)/([0-9]+)/?$ /$1/view.htm?id=$2 </IfModule> JkMount /* jsp-hostname ErrorLog "/var/log/dummy-host.example.com-error_log" CustomLog "/var/log/dummy-host.example.com-access_log" common </VirtualHost>
The problem is that the second rewrite rule does not work. Requests skip to JBoss unchanged, so I get a Tomcat 404 error. But if I add a redirect flag to the second rule, for example
RewriteRule ^/([^/]+)/([0-9]+)/?$ /$1/view.htm?id=$2 [R,L]
It works like a charm. But redirecting is not what I need here :). I suspect the problem is that requests are being transferred to another host (192.168.1.2), but I really don't know how to make it work. Any help would be appreciated :)
source share