[lug] apache

D. Stimits stimits at idcomm.com
Tue Jan 30 15:11:31 MST 2001


Hugh Brown wrote:
> 
> I am trying to setup a page that requires authorization to access, but
> based on who the user is, I'd like it to redirect to a page specific to
> the user.  Is it possible to do this with apache and if not, how would
> you all do it.
> 
> For example,
> 
> I have a bunch of clients and I want to put a link on the main page that
> says "Go to your client account."  This link will point at
> www.mycompany.com/clients            within that directory there will be
> directories for each of the clients.  I can password protect
> www.mycompany.com/clients/index.html.  I would like to be able to
> redirect client1 to www.mycompany.com/clients/client1/index.html if
> someone logs in with the username client1.
> 
> Hugh

Have the submit of client name run a cgi script rather than html page;
put a MySQL or other SQL interface into the cgi script (I'd use C++ for
it, but there are a lot of people who would cringe and instead use PHP,
Python, or Perl for that). Ignore actually forwarding them to the
individual directories per se, create all output by the cgi copying html
files or templates out of the client directory (you'll probably write a
cookie to identify the session). Alternatively, if they have javascript
enabled (I hate javascript, all the browsers have some feature that
behaves differently than other browsers, and ten times as many features
that are outright broken), have the cgi send a normal javascript
redirect (the redirect link could be listed in the SQL). There are
actually a lot of creative ways to do this with cgi and/or javascript,
but most of the sane/flexible (try not to laugh too hard) ones involve
SQL.



More information about the LUG mailing list