Forum Moderators: mack

Message Too Old, No Replies

Load user-specific page based on username from basic authentication

         

Ray_Johnson

2:31 pm on Mar 20, 2007 (gmt 0)

10+ Year Member



I have a directory (http://www.example.com/clients) that is .htaccess/.htpasswd protected. The .htpasswd file is above the webroot. Basic authentication works and I'm prompted for a username/password.

I have a page (http://www.example.com/clients/login.php) that I want to have links that will redirect to


http://www.example.com/clients/USERNAME/foobar.php

and

http://www.example.com/clients/USERNAME/widgets.php

and others.

Every client will have his own directory with the foobar.php, widgets.php and other files in it.

How do I set up the links using the username supplied from the authentication?

register_globals is turned on if that makes a difference.

phranque

7:10 am on Mar 21, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you might try something like this in .htaccess and see what happens:
rewriteEngine on
rewriteCond %{REMOTE_USER} ^([a-z0-9_]+)$
rewriteRule (.*) /clients/%1/$1 [L]