Entry
How can I direct a user to a different page , based on the username, from one central page that all users access.
Jul 16th, 2002 14:16
Jack Nerad, Richard Kut, http://httpd.apache.org/docs/mod/mod_rewrite.html
You can either write a script to do this, or if using mod_auth and
mod_rewrite, via a RewriteRule.
When a user successfully authenticates, the webserver sets the
environment variable REMOTE_USER. You can use environment variables in
rewrite rules. This means that you can redirect to a page based on the
username of the authenticated user.
(in a .htaccess file)
RewriteEngine On
RewriteRule ^access$ http://my.srvr.com/%{REMOTE_USER}/index.html [R]
If a user requests http://my.srvr.com/access that is password
protected with mod_auth, after they successfully authenticate, they will
be redirected to username/index.html on the server.
Note that this does not protect the urls to which you are redirecting,
but only redirects to a directory based on the REMOTE_USER environment
variable.