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 acer asus bios bsod computer crash drive driver drivers error ethernet excel freeze games gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard netgear network printer problem ram random registry router slow software sound trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless xbox
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Controlling access to two different folders using .htaccess

Reply  
Thread Tools
DrP's Avatar
DrP DrP is offline
Computer Specs
Senior Member with 667 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
02-Nov-2009, 01: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, 06: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
Computer Specs
Senior Member with 667 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
02-Nov-2009, 03: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, 03: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 at 03:35 AM..
SNewman's Avatar
Member with 82 posts.
 
Join Date: Feb 2006
Location: New Jersey
Experience: Intermediate
03-Nov-2009, 01: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

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




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



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 04:01 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.