Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Web Design & Development
Tag Cloud
access audio black screen blue screen boot bsod connection crash dell desktop drivers dvd email error excel excel 2003 firefox hard drive hardware hdmi hijackthis internet keyboard laptop malware monitor motherboard network networking outlook problem recovery router safe mode screen slow sound spyware tdlwsp.dll trojan vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Controlling access to two different folders using .htaccess

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

 
Thread Tools
DrP's Avatar
DrP DrP is offline
Senior Member with 525 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
02-Nov-2009, 12:56 AM #1
Controlling access to two different folders using .htaccess
Hi,
I've successfully protected two folders (press and trade) using .htaccess and .htpasswd. The .htpasswd file contains two usernames and two passwords. Fine. However, when a user logs in to the trade folder, they automatically have access to the press folder and vice versa.
Is there any way, using this method, that I can allow access to the press folder using one username/password and access to the trade folder with another username/password?
Thanks,
__________________
Clive
Lordandmaker's Avatar
Computer Specs
Member with 71 posts.
 
Join Date: Sep 2009
Location: London
Experience: Intermediate
02-Nov-2009, 05:50 AM #2
Where are they with respect to each other?

How have you configured it? What do the relevant bits of your apache config file look like?
DrP's Avatar
DrP DrP is offline
Senior Member with 525 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
02-Nov-2009, 02:19 PM #3
I've two folders, Press and Trade. The following .htaccess in each folder:

AuthType Basic
AuthName "restricted area"
AuthUserFile /home/graveyar/.htpasswds/.htpasswd
require valid-user

and obviously the password file. Does .htpasswd have to be called that, or can I call it something else? And I'm on shared hosting so cannot access the config file.
__________________
Clive
Lordandmaker's Avatar
Computer Specs
Member with 71 posts.
 
Join Date: Sep 2009
Location: London
Experience: Intermediate
03-Nov-2009, 02:21 AM #4
.htpasswd can be called whatever you want, so long as you specify it with AuthUserFile.
Are the two dirs sharing a .htpasswd? Do they have the same realm? They shouldn't.

Where are the dirs with respect to each other?

Last edited by Lordandmaker : 03-Nov-2009 02:35 AM.
SNewman's Avatar
Member with 57 posts.
 
Join Date: Feb 2006
Location: New Jersey
Experience: Intermediate
03-Nov-2009, 12:46 PM #5
The two .htaccess files are pointing to the same .htpasswd file which is why they are gaining access to both folders. You are in fact able to name .htpasswd files differently, so I would suggest naming one .htpasswd1 and the other .htpasswd2 (or something like that) and changing your .htaccess files appropriately.
__________________
Scott Newman

Serving n00bz since 2005!
Reply Bookmark and Share

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 01:52 AM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.