Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: redirect user |
|
Author |
|
charbel.asmar
Joined: 22 Jan 2008 Posts: 1
|
Posted: Tue 22 Jan '08 9:48 Post subject: redirect user |
|
|
Hi,
i would like to know how to redirect a user to other directory example:
Alias /mydata "D:\myfolder"
<Directory "D:\myfolder">
Options Indexes FollowSymLinks
AllowOverride AuthConfig
AuthType Basic
AuthName "Restricted Files"
AuthUserFile "C:\apache\conf\passwords"
Require user user1
Require user user2
Order allow,deny
Allow from All
</Directory>
I want user2 to be redirect to other directory like test data if he passed the authentication |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 25 Jan '08 18:18 Post subject: |
|
|
Code: |
Redirect permanent /path/to/file.htm
|
I'm not sure which rule takes first effect. Try out |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 25 Jan '08 20:04 Post subject: |
|
|
If you only want to re-direct user2, but not user1 or any other user - you may need to use mod_rewrite to change the URI based on the user name.
Maybe mod_rewrite rules like this will work for you: Code: | Alias /testdata "D:/test_data"
RewriteCond %{REMOTE_USER} user2
RewriteRule /?(.*) /testdata/$1 [L] |
Make sure that the directory which the /testdata URI is aliased to has a <Directory> block which:* allows access from any host (Allow from all)
* is password-protected to only allow user2 (Require user user2) Hope this helps,
-tom-
p.s. Your example shows backslashes (\) in the directory names. You should always use forward slashes (/) in httpd.conf, even on Windows. |
|
Back to top |
|
|
|
|
|
|