Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 17th, 2005, 12:03 AM
blastbum blastbum is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Sydney, Australia
Posts: 30 blastbum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 44 sec
Reputation Power: 4
I need a simple .htaccess script

Hi,

First of all I would like to point out that I'm new to .htaccess.

I need a simple .htaccess script that asks for a username and password when you go to a site (eg; www.whatever.com).

I would like it to allow different sets of usernames and passwords that allow access to different pages.

As an example, if you put in the username and password:

Username: whatever
Password: whatever49

It would then grant access to the "/whatever.html" page.

Thank you very much for your help.

Blastbum

Reply With Quote
  #2  
Old February 17th, 2005, 12:46 PM
dtam dtam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 9 dtam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 53 sec
Reputation Power: 0
Quote:
Originally Posted by blastbum
Hi,

First of all I would like to point out that I'm new to .htaccess.

I need a simple .htaccess script that asks for a username and password when you go to a site (eg; www.whatever.com).

I would like it to allow different sets of usernames and passwords that allow access to different pages.

As an example, if you put in the username and password:

Username: whatever
Password: whatever49

It would then grant access to the "/whatever.html" page.

Thank you very much for your help.

Blastbum



Put this code in the directory you want protected

AuthName "whatever you want called"
AuthType Basic
AuthUserFile location/of/where/you/want/your/.htpasswd file

require valid-user

Reply With Quote
  #3  
Old February 17th, 2005, 01:17 PM
playjam99 playjam99 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 74 playjam99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 9 m 36 sec
Reputation Power: 4
what should the /htpasswd file contain ?

Reply With Quote
  #4  
Old February 17th, 2005, 01:20 PM
dtam dtam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 9 dtam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 53 sec
Reputation Power: 0
htpasswd file is the file that keeps the users/password in it so it can authenticate.

you will need to run a command on your linux box like

htpasswd -c .htpasswd username

the -c is for creating the file if its not already there.

If you already have .htpasswd file created then just do the command without the -c

Reply With Quote
  #5  
Old February 17th, 2005, 01:24 PM
playjam99 playjam99 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 74 playjam99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 9 m 36 sec
Reputation Power: 4
ok so this means that it cant work if you have windows not linux ? Will it work if ive got apache under windows. ?

Reply With Quote
  #6  
Old February 17th, 2005, 01:26 PM
dtam dtam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 9 dtam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 53 sec
Reputation Power: 0
ah it should work just don't use apache on windows =(

Sorry thought you were referring to a linux box. But I am sure you can do the same on it, just won't know how to execute that command.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > I need a simple .htaccess script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway