Forum Moderators: phranque
I Have problems when I config RewriteRule.
I need authenticate users, and that users go yours own directory, All users are in the same directory base.
Once I make a similar configuration:
<Directory /users/www/mydirectory>
AuthName "MyAuth"
AuthType Basic
AuthUserFile path_to_file_users
require valid-user
RewriteEngine On
RewriteRule ^index\.htm$ [mysite.cl...] [R,L]
</Directory>
and this configuration works!, but the difference now is I not have an index file, because must generate directory listing and when try redirect the default index.html of apache, not found in the directory ...
My config is:
<Directory "/home/users">
Options MultiViews +Indexes FollowSymLinks
IndexOptions FancyIndexing
AllowOverride Authconfig
AuthType Basic
AuthName "Ingrese su usuario y clave"
AuthUserFile key_file
Require valid-user
RewriteEngine on
RewriteRule ^/$ [bckup.mysite.cl...] [PT]
I try too with directory but without result
##RewriteRule ^/$ /%{REMOTE_USER}/backup/
The content of each user's dir are theirs backups files (.doc .xls .jpg etc)
The dirs are of form
/home/users/<usuario1>/backup/
/home/users/<usuario2>/backup/
When apache authentificate the users they go to /home/users and they can to see other users.
How can I redirect the inex generated with directory listing?
Thanks for your help
Sylvia
RewriteRule ^/$ /%{REMOTE_USER}/backup/ You may be able to verify this by testing and examining server access and error logs. For example:
# Rewrite to blank remote user info page if REMOTE_USER is blank
RewriteCond %{REMOTE_USER} ^$
RewriteRule ^/$ /blank_remote_user_found_page.html
# Else rewrite to user's backup directory
RewriteRule ^/$ /%{REMOTE_USER}/backup/ If it is an auth domain problem, and you can't re-define the auth domain or re-structure the "user" subdomains and/URLs to avoid that, then you could set a cookie on the initial "authorize" page, and then use the cookie value as the user navigates around the site:
RewriteCond %{HTTP_COOKIE} ^user=([a-z0-9_\-]+)$ [NC]
RewriteRule ^/$ /%1/backup/ You can set cookies with a server-side script, a client-side script, or on Apache 2.x and later, with mod_rewrite.
Jim