|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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 ![]() |
|
#2
|
|||
|
|||
|
Quote:
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 |
|
#3
|
|||
|
|||
|
what should the /htpasswd file contain ?
|
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
ok so this means that it cant work if you have windows not linux ? Will it work if ive got apache under windows. ?
|
|
#6
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > I need a simple .htaccess script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|