Forum: 

mod_rewrite in tomcat on apache

Hi,

I am trying to find a way to add rewrite rules. I enabled by doing

a2enmod rewrite

I am adding below rules to httpd.conf but no effect. I am not sure what else need to added to make mod_rewrite to work. Please advise.

RewriteEngine on
#
RewriteCond %{HTTP_USER_AGENT} Googlebot¦Slurp/¦msnbot [NC]
RewriteRule ^/(.*);jsessionid= http://www.example.com/$1 [R=301,L]
#
RewriteCond %{QUERY_STRING} &?ts=
RewriteCond %{HTTP_USER_AGENT} Googlebot¦Slurp/¦msnbot [NC]
RewriteRule ^/(.*)$ http://www.example.com/$[b]1?[/b] [R=301,L]

Thanks,

Srini.
 

Jeremy Davis's picture

TBH I haven't used the Tomcat Apache appliance much and the little I have I haven't had a lot of luck getting it to do what I wanted. So I'm probably not much use to you.

But IIRC Apache acts as a proxy for Tomcat but requires a bit of initial config to serve html. Perhaps that is why you are getting odd (no?) behaviour from your redirects? Check the TKL Docs - IIRC it's under 'Appliance Specific Notes' (or similar wording). Also perhaps it's worth checking your Apache logs and see if they give you any hints.

Jeremy Davis's picture

TBH I haven't used the Tomcat Apache appliance much and the little I have I haven't had a lot of luck getting it to do what I wanted. So I'm probably not much use to you.

But IIRC Apache acts as a proxy for Tomcat but requires a bit of initial config to serve html. Perhaps that is why you are getting odd (no?) behaviour from your redirects? Check the TKL Docs - IIRC it's under 'Appliance Specific Notes' (or similar wording). Also perhaps it's worth checking your Apache logs and see if they give you any hints.

Post new comment