logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: redirect user
Author
charbel.asmar



Joined: 22 Jan 2008
Posts: 1

PostPosted: Tue 22 Jan '08 9:48    Post subject: redirect user Reply with quote

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: 7298
Location: Germany, Next to Hamburg

PostPosted: Fri 25 Jan '08 18:18    Post subject: Reply with quote

Code:

Redirect permanent /path/to/file.htm


I'm not sure which rule takes first effect. Try out Wink
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Fri 25 Jan '08 20:04    Post subject: Reply with quote

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


Reply to topic   Topic: redirect user View previous topic :: View next topic
Post new topic   Forum Index -> Apache