Solved

.htaccess and who

Posted on 1998-09-07
2
167 Views
Last Modified: 2013-12-25
Hi!

How do I write a .htaccess file that sends one user that logs in somewhare and a other user somewhere else....

ex. User joe is going to html/joe and user boss to html/boss.
0
Comment
Question by:timeman
2 Comments
 
LVL 1

Accepted Solution

by:
evilgreg earned 200 total points
ID: 1828564
You can't. Htaccess only applies to files, and can't do anything more. You can, however, pass control to a simple cgi script
that can redirect to the correct page by checking out the username. In the example above for instance, htaccess could
protect access to a script that looked like this:

#!perl
$|++;
$name = $ENV{"REMOTE_USER"};
if ($name eq "joe") { $loc = "joe.html"; }
if ($name eq "boss") { $loc = "boss.html"; }
$location = "http://mysite.com/blahblah/$loc";
print "Location: $location\n\n";

A simple example, but you get the idea. Htaccess is simply
a password scheme, but has no filtering based on the
username. If you going to use a cgi script anyway, you
could even get rid of using htaccess and use the script
to validate (and filter) the users with a simple form.


0
 

Expert Comment

by:tong111797
ID: 2246842
how 2 call CGI script inside .htaccess ?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question