httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: [users@httpd] RegEx Matches within LocationMatch and Basic Auth
Date Mon, 14 Jul 2003 23:54:50 GMT

On Mon, 14 Jul 2003, John Kaminski wrote:
> I would like to use the regex match as a parameter to the "require user"
> paramter.  If this can't be done is there something else I can do that would
> accomplish the same thing. Thank you for your help in advance.

There is no easy way to do this.  A difficult way is

RewriteEngine On
RewriteCond %{REQUEST_METHOD} !(GET|HEAD|OPTIONS)
RewriteRule ^/publishers/[^/]*/?(.*) /publishers/%{LA-U:REMOTE_USER}/$1

<Location /publishers>
Require valid-user
...
</Location>

This is untested, and it probably has some errors, but it may give you an
idea.  Note that it allows any authenticated user to access any url under
publishers, but it silently puts them in their own directory no matter
where they tried to access.  A perhaps cleaner way to do it would be to
simply use

RewriteEngine On
RewriteCond %{REQUEST_METHOD} !(GET|HEAD|OPTIONS)
RewriteRule ^/publishers/(.*) /publishers/%{LA-U:REMOTE_USER}/$1

and then all publishers would access the same URL but would be put in the
correct directory based on their username.

Also note that apache 1.3 has "require file-owner" and "require
file-group" configurations in mod_auth.  But I don't think they will do
what you want.

Joshua.

---------------------------------------------------------------------
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


Mime
View raw message