Solved

.htaccess and who

Posted on 1998-09-07
2
162 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
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 modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now