Hello! My problem is as follows: I have JBoss 4.2.3 application server with AJP 1.3 connector running on one host under Windows (192.168.1.2 for my test environment) and
Apache 2.2.14 running on another FreeBSD box (192.168.1.10).
Apache acts as a "front gate" for all requests and sends them to JBoss via mod_jk. Everything was working fine until I had to do some SEO optimizations. These optimizations include SEF urls, so i decided to use mod_rewrite for
Apache to alter requests before they are sent to JBoss. Basically, I nedd to implement 2 rules:
Redirect old rules like "http://hostname/directory/" to "http://hostname/" with permanent redirect
Forward urls like "http://hostname/wtf/123/" to "http://hostname/wtf/view.htm?id=123" so that end user doesn't see the "ugly" URL (the actual rewrite).
Here is my
Apache config for test virtual host:
<VirtualHost *:80>
ServerAdmin
[email protected]
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 second rewrite rule doesn't work. Requests slip through to JBoss unchanged, so I get
Tomcat 404 error. But if I add redirect flag to the second rule like
RewriteRule ^/([^/]+)/([0-9]+)/?$ /$1/view.htm?id=$2 [R,L]
it works like a charm. But redirect is not what I need here :) . I suspect that the problem is that requests are forwarded to the another host (192.168.1.2), but I really don't have any idea on how to make it work. Any help would be appreciated :)