You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by srinivas yelamanchili <y_...@yahoo.com> on 2013/11/22 13:56:52 UTC

mod_jk.conf redirect context to different tomcat url

Hi,
my tomcat webapps has folders App and AppXyz and apache mod_jk.conf has the line:
JkMount /App* worker1

So today Apache requests for /App and /AppXyz go to Tomcat /App and /AppXyz respectively.

Now I want to change this redirection so all Apache requests of type /App* go to Tomcat /App only (and not AppXyz)
How to accomplish this?

Thanks,
-sri

Re: mod_jk.conf redirect context to different tomcat url

Posted by srinivas yelamanchili <y_...@yahoo.com>.
Neven, you are the MAN !!! It worked !

I uncommented the below line in httpd.conf:
#LoadModule rewrite_module modules/mod_rewrite.so

and added:
<IfModule rewrite_module>
     RewriteEngine on
     RewriteRule ^/AppXyz(.*) /App$1 [R,L]
</IfModule>

Thank you,
-sri





On Friday, November 22, 2013 3:01 PM, Neven Cvetkovic <ne...@gmail.com> wrote:
 
On Fri, Nov 22, 2013 at 2:49 PM, srinivas yelamanchili <y_...@yahoo.com>wrote:

> I tried each of these lines and they don't work:
> Redirect /AppXyz /App
> Alias /AppXyz /App
>
> The apache access_log file shows:
> GET /AppXyz/javascript/mojo/js/source/...
>
> Shouldn't it be 'App' instead of 'AppXyz' ?
>
>
Sri, use RewriteEngine instead.



>
> Here's an example:
>
> RewriteEngine on
> RewriteRule ^/AppXyz(.*) /App$1 [R,L]
>
> I have not tested this, but should work something like this:
> http://yourhost/AppXyz/somepath/here ---redirects-->
> http://yourhost/App/somepath/here
>
> Hope that helps!
>

Re: mod_jk.conf redirect context to different tomcat url

Posted by Neven Cvetkovic <ne...@gmail.com>.
On Fri, Nov 22, 2013 at 2:49 PM, srinivas yelamanchili <y_...@yahoo.com>wrote:

> I tried each of these lines and they don't work:
> Redirect /AppXyz /App
> Alias /AppXyz /App
>
> The apache access_log file shows:
> GET /AppXyz/javascript/mojo/js/source/...
>
> Shouldn't it be 'App' instead of 'AppXyz' ?
>
>
Sri, use RewriteEngine instead.


>
> Here's an example:
>
> RewriteEngine on
> RewriteRule ^/AppXyz(.*) /App$1 [R,L]
>
> I have not tested this, but should work something like this:
> http://yourhost/AppXyz/somepath/here ---redirects-->
> http://yourhost/App/somepath/here
>
> Hope that helps!
>

Re: mod_jk.conf redirect context to different tomcat url

Posted by srinivas yelamanchili <y_...@yahoo.com>.
I tried each of these lines and they don't work:
Redirect /AppXyz /App
Alias /AppXyz /App

The apache access_log file shows:
GET /AppXyz/javascript/mojo/js/source/...

Shouldn't it be 'App' instead of 'AppXyz' ?

Thanks,
-sri




On Friday, November 22, 2013 8:46 AM, srinivas yelamanchili <y_...@yahoo.com> wrote:
 
Thanks Neven, I will try that and also the 'Alias'
http://httpd.apache.org/docs/current/mod/mod_alias.html







On Friday, November 22, 2013 8:21 AM, Neven Cvetkovic <ne...@gmail.com> wrote:

On Fri, Nov 22, 2013 at 7:56 AM, srinivas yelamanchili <y_...@yahoo.com>wrote:


> So today Apache requests for /App and /AppXyz go to Tomcat /App and
> /AppXyz respectively.
>
> Now I want to change this redirection so all Apache requests of type /App*
> go to Tomcat /App only (and not AppXyz)
> How to accomplish this?
>

Sri, this is probably question for Apache configuration. You can achieve
this with "mod_rewrite", see the documentation for details:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Here's an example:

RewriteEngine on
RewriteRule ^/AppXyz(.*) /App$1 [R,L]

I have not tested this, but should work something like this:
http://yourhost/AppXyz/somepath/here ---redirects-->
http://yourhost/App/somepath/here

Hope that helps!

Re: mod_jk.conf redirect context to different tomcat url

Posted by srinivas yelamanchili <y_...@yahoo.com>.
Thanks Neven, I will try that and also the 'Alias'
http://httpd.apache.org/docs/current/mod/mod_alias.html






On Friday, November 22, 2013 8:21 AM, Neven Cvetkovic <ne...@gmail.com> wrote:
 
On Fri, Nov 22, 2013 at 7:56 AM, srinivas yelamanchili <y_...@yahoo.com>wrote:


> So today Apache requests for /App and /AppXyz go to Tomcat /App and
> /AppXyz respectively.
>
> Now I want to change this redirection so all Apache requests of type /App*
> go to Tomcat /App only (and not AppXyz)
> How to accomplish this?
>

Sri, this is probably question for Apache configuration. You can achieve
this with "mod_rewrite", see the documentation for details:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Here's an example:

RewriteEngine on
RewriteRule ^/AppXyz(.*) /App$1 [R,L]

I have not tested this, but should work something like this:
http://yourhost/AppXyz/somepath/here ---redirects-->
http://yourhost/App/somepath/here

Hope that helps!

Re: mod_jk.conf redirect context to different tomcat url

Posted by Neven Cvetkovic <ne...@gmail.com>.
On Fri, Nov 22, 2013 at 7:56 AM, srinivas yelamanchili <y_...@yahoo.com>wrote:

> So today Apache requests for /App and /AppXyz go to Tomcat /App and
> /AppXyz respectively.
>
> Now I want to change this redirection so all Apache requests of type /App*
> go to Tomcat /App only (and not AppXyz)
> How to accomplish this?
>

Sri, this is probably question for Apache configuration. You can achieve
this with "mod_rewrite", see the documentation for details:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Here's an example:

RewriteEngine on
RewriteRule ^/AppXyz(.*) /App$1 [R,L]

I have not tested this, but should work something like this:
http://yourhost/AppXyz/somepath/here ---redirects-->
http://yourhost/App/somepath/here

Hope that helps!