Skip to content

mod_rewrite and redirecting to mod_jk URLs

December 18, 2008

I was setting up a tomcat server for a company which was trying to host various softwares (jira, confluence wiki, alfresco) on a single tomcat so none of these apps where in the root context of tomcat rather in “/jira”, “/wiki” etc. My setup is using a front end apache httpd 2.2 on ubuntu box with mod_jk. Here is my config to preserve none-root context for these apps and still use vhost domains to reach each of these apps (e.g jira.mycompany.org)

<VirtualHost x.y.z.w:80>
        ServerName jira.mycompany.com
        ServerAdmin amin@mycompany.com
        DocumentRoot /

        ErrorLog /var/log/apache2/jira-error.log
        LogLevel warn
        CustomLog /var/log/apache2/jira-access.log combined

        RewriteEngine on
        RewriteLog /var/log/apache2/jira-rewrite.log
        RewriteLogLevel 3
        RewriteRule "^/(.[^jira])*$" "/jira/$1" [PT]

        # JK
        JkMount /* jira
</VirtualHost>

This redirects “http://jira.mycompany.com/&#8221; to “http://jira.mycompany.com/jira/&#8221; and tomcat remains happy :)

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: