TurnKey Linux Virtual Appliance Library

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's picture

Not really sure...

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's picture

Not really sure...

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

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)