473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

.htaccess redirects according to user/pw combination?

1
Hi all,

I need to set up an .htaccess file in a root folder that requires a username and a password, and will direct the user to a different folder depending on the username and password entered.

E.g.:
  1. The user goes to www.example.com/
  2. They enter their username (bobsmith) and password (923r9w8c2w)
  3. They are redirected to www.example.com/bobsfolder/
  4. If a user goes to www.example.com/bobsfolder/ directly, they are prompted for a user name and password BUT do not have to re-enter it if they have already.

This is so that I can have multiple folders and multiple users, but only need to provide them with one common link.

Does anyone know if and how this can this be done? Thanks for reading this.
Mar 23 '09 #1
1 3335
prabirchoudhury
162 100+
1. use session to carry the logged in user details.
2. when user logged in true then put username and other details assigned with session variables

3. check with session all the time when page start.

4. if the user is not logged in then session is empty and then should redirect to the login page otherwise, identify with the session user and give access to the page they have permission to.

dont knw what language you are using, so have different way to use session for user identification but same logic.


hope that might help you....
May 10 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yawnmoth | last post by:
i'm trying to write a php script that will password protect some random directory by creating a .htaccess file, and a password file to accompany the .htaccess file, and it isn't working... ...
1
by: Marko Lahtinen | last post by:
Hello! A part of my website is protected with a .htaccess file. Can I somehow bypass the username/password dialog ?? Can I somehow "hardcode" the authentication name and password in my php-file...
15
by: Taki Jeden | last post by:
Hello everybody Does anybody know why w3c validator can not get pages that use 404 htaccess redirection? I set up two web sites so that clients request non-existent urls, but htaccess redirects...
0
by: Jack Hambabo | last post by:
Hi, I'm searching for a php script that can find out whether the current user (I know _SERVER will give me the name for non-cgi php) has the right to view a specific file. My dream is that I...
5
by: Nosferatum | last post by:
I am in need of a solution on how to solve this problem: I need to limit access to six different folders. My users are validated in a system which check their prescence with a couple of...
2
by: jaanus | last post by:
Here we go... What I have been trying to do is to forward all http requests containing /cms/ to http://cms.mydomain.com/ example1: http://host1.mydomain.com/cms/init.php would be parsed from...
1
by: dominoeffect | last post by:
Hi all, I (hastily) updated my .htaccess to include this 3G blacklist which blocks scrapers, hackers and the like. perishablepress.com/press/2008/05/13/perishable-press-3g-blacklist/ ...
6
by: mrozko | last post by:
Hi, I hope my message is not "out of topic".... I would like to make "clean URLs" on my website.... Is it possible to make something like this: orig. URL: /inde.php?mcat=1&subcat=2
2
Markus
by: Markus | last post by:
Why is it not working? I joke. Here's the info: In the folder C:\host\www\test, I have an .htaccess file. Inside that .htaccess file is the following: RewriteEngine On RewriteRule...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.