httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Lazic <>
Subject [users@httpd] mod_rewrite and Location(Match)?
Date Tue, 28 Mar 2006 14:09:17 GMT

we have a customer who needs a specific query-string and location
password protected.

The location is protected by LocationMatch containing Basic-Auth.

The setup in our webserver is:

<LocationMatch "apps/test">
  AuthType Basic
  AuthName "Auth-Part"
  AuthUserFile /usr/local/apache/conf/.auth1htpasswd
  AuthGroupFile /usr/local/apache/conf/.auth1htgroup
  <Limit GET POST>
    require group authgr1

Some Requests do not have the 'apps/test' as prefix but  the
query-string contains 'auth=require' which also requires

We tried to solve this by using mod_rewrite.

Our setup is:

RewriteCond %{LA-U:REMOTE_USER} =""
RewriteCond %{QUERY_STRING} .*auth=require.*
RewriteRule ^.+$ /apps/test/\? [L,R,NS]

This causes every unauthorized request to be redirected to the protected


<Directory /usr/local/apache/htdocs>
  RewriteEngine on

  RewriteRule ^/?test/?$ /apps/test.jsp?Param1=Value1&Param2=Val2 [QSA,NS]

<LocationMatch  "\.jsp">
  SetHandler app-handler

<VirtualHost _default_:443>


  <LocationMatch  "\.jsp">
    SetHandler weblogic-handler

  RewriteEngine on

  RewriteRule ^/?test/?$ /apps/test.jsp?Param1=Value1&Param2=Val2 [QSA,NS]

I have tested the setup with the aktiv RewriteRule in the VirtualHost
and inaktiv in the global Scope.

Apache try to get the file:


[test.server/sid#82987b0][rid#8455820/initial] (1) go-ahead with \
/usr/local/apache/htdocs/apps/test.jsp [OK]

But when i deaktivate the RewriteRule in the VirtualHost and aktivate in
the global Scope the apache make the request to the Appserver.

[test.server/sid#8312088][rid#84766d0/initial/redir#1] (1) [per-dir \
/usr/local/apache/htdocs/] pass through /web/sportal3/htdocs/apps

Please can anybody help us.



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message