Client login via .htaccess


I’m a newbie to the forums <-Great resource so far

I will have different clients that will not know about each other and will need to login via a generic Customer login username/password boxes - My question is- how do I send them to their respective folders based on the username/password combo? My ‘a’ user group needs to go to the A site and the ‘b’ user group needs to be directed to the B site etc…
Can this be done simply with an .htaccess file -if so can anybody provide some examples?
Do we need to use php -if so any examples or links that specifically cover this subject?
Are there dreamhost specific issues here? What will happen to each groups password protected pages when they need to access general unprotected scripts?
My brain hurts from the learning curve



/Thinking out loud.

You should be able to do this using only .htaccess. If you were to use mod_basic_auth ( sp? ) to do the authentication and the use mod_rewrite to redirect the user based on their credentials. That would eliminate the need for an extra layer of scripts be it php or perl or whatever.

I’ll look into this on the weekend. I’m away now until tomorrow morning. There are far simpler solutions, which people will probbly chip in with, but keeping this only to .htaccess is intersting. I wonder if it can be done with only one .htaccess file.

/End of wondering.

  • wil


Thanks Wil

Lack of sleep, coffee, and early morning hours let me post this to the wrong forum

And I’m great fan of far simpler methods so if anybody has any thoughts -please post’em


Hi, I am wondering about the solution to this also. I have two separate areas that users can go to, and want to have just one link, the user puts in their user name and password, and depending on that, gets to go to pageA or pageB.

Also, does anyone know how to add a form on their main page, with the username and password field, instead of a link, that still uses the htaccess, or should I look into an external way of password protection here?



How about something like…

[code]RewriteCond %{REMOTE_USER} ^userX$
RewriteRule ^/$ /userx_home.htm

RewriteCond %{REMOTE_USER} ^userY$
RewriteRule ^/$ /usery_home.htm[/code]blueorder