I'm quite new to apache so any help is appreciated! I've got Apache and tomcat (through mod_jk) running on my desktop. I defined all static files (i.e HTML) to be served by apache and all jsp to be forwarded to tomcat
I can access all jsp and html files directly without a problem. For example:
- localhost/sb/jsp/index.html - works
- localhost/sb/jsp/dates.jsp - works
I'm trying to rewrite all URLs so wouldn't need to go through sb/jsp. Meaning:
- localhost/index.html rewrite to localhost/sb/jsp/index.html
- localhost/dates.jsp rewrite to localhost/sb/jsp/dates.jsp
Pretty simple right?
The problem is that mod_rewrite works great for html but not for jsp. I can even see in the log that the rewrite is enforced for the jsp file but I still get a 404:
127.0.0.1 - - [31/Jul/2010:22:01:04 +0300] [localhost/sid#9154d0][rid#927ce0/initial] (2) init rewrite engine with requested uri /dates.jsp
127.0.0.1 - - [31/Jul/2010:22:01:04 +0300] [localhost/sid#9154d0][rid#927ce0/initial] (3) applying pattern '/dates.jsp' to uri '/dates.jsp'
127.0.0.1 - - [31/Jul/2010:22:01:04 +0300] [localhost/sid#9154d0][rid#927ce0/initial] (2) rewrite '/dates.jsp' -> '/sb/jsp/dates.jsp'
127.0.0.1 - - [31/Jul/2010:22:01:04 +0300] [localhost/sid#9154d0][rid#927ce0/initial] (2) local path result: /sb/jsp/dates.jsp
127.0.0.1 - - [31/Jul/2010:22:01:04 +0300] [localhost/sid#9154d0][rid#927ce0/initial] (1) go-ahead with C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/sb/jsp/dates.jsp [OK]
Does any one have any idea why this happens? Pasted below is the mod_jk.conf where I configured everything.
########## Auto generated on Sat Jul 31 20:46:04 IDT 2010##########
<IfModule !mod_jk.c>
LoadModule jk_module "modules/mod_jk.so"
</IfModule>
<VirtualHost localhost>
ServerName localhost
# Options +FollowSymLinks
RewriteLogLevel 9
RewriteLog "C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/rewrite.log"
RewriteEngine on
RewriteRule /index.html /sb/jsp/index.html
RewriteRule /dates.jsp /sb/jsp/dates.jsp
# JkMount / ajp13
JkMount /*.jsp ajp13
DocumentRoot "C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps"
JkMount /manager ajp13
JkMount /manager/* ajp13
# JkMount /sb ajp13
# JkMount /sb/* ajp13
JkMount /docs ajp13
JkMount /docs/* ajp13
JkMount /examples ajp13
JkMount /examples/* ajp13
JkMount /host-manager ajp13
JkMount /host-manager/* ajp13
</VirtualHost>