You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lars Ohlén <la...@ohlen.se> on 2005/10/15 11:37:59 UTC

[users@httpd] Apache 2: mod_rewrite

Hi,

We have recently installed Apache 2.0.54 and very pleased with the product.

Now I need to understand how to setup mod_rewrite for this senario (newbee question I guess)

We have some .jsp and servlets that are used as normal within our web application (using mod_jk to forward these req. to a tomcat process)
Some of these scripts are also accessed by external script  (ex. wget)

Because of the security product we are using for single sign-on these scripts needs to be accessed with a differnt URL
(this allowing the security product to handle the authentiacatin differently: NTLM for users and Basic Auth. for scripts)

So the same script (ex TheServlet) needs to be accessed both using the URL

/webapp/servlet/TheServlet and
/script/servlet/TheServlet

The easy solution is of course to duplicate the webapp and to create an additional script web application with the same scripts. But
this is not very good from a maintance point of view (needs to duplicate many scripts and helper classes)

But could this not be solved using mod_rewrite?

Simpy to map /script to /webapp

Preferably we would like to control each indivdual script and to have mod_rewrite to append some extra information so that the
script could (if needed) identify if the invocation was from a script of from a webapp user.


Please advice!

BR

Lars



   




Re: [users@httpd] Apache 2: mod_rewrite

Posted by Krist van Besien <kr...@gmail.com>.
On 10/15/05, Lars Ohlén <la...@ohlen.se> wrote:

> So the same script (ex TheServlet) needs to be accessed both using the URL
>
> /webapp/servlet/TheServlet and
> /script/servlet/TheServlet
>
> The easy solution is of course to duplicate the webapp and to create an
> additional script web application with the same scripts. But
> this is not very good from a maintance point of view (needs to duplicate
> many scripts and helper classes)
>
> But could this not be solved using mod_rewrite?
>
> Simpy to map /script to /webapp
>
> Preferably we would like to control each indivdual script and to have
> mod_rewrite to append some extra information so that the
> script could (if needed) identify if the invocation was from a script of
> from a webapp user.

Something like

RewriteEngine On
RewriteRule /script/servlet/(.*)       /webapp/servlet/$1?script=yes [QSA]

maybe?


Krist

--
krist.vanbesien@gmail.com
Solothurn, Switzerland

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org