Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set up .htaccess authentication on Windows.

.htaccess

How to set up .htaccess authentication on Windows.

by  Wullie  Posted    (Edited  )
The following is a step by step guide on how to set up htaccess password protection on Windows with Apache.

Firstly, open notepad or another text editor and enter the following but change the [color red]AuthUserFile[/color] path to reflect where you are going to place your htpasswd file. (It does not have to be within the protected directory).


AuthUserFile /www/domain/directory/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted Area"
AuthType Basic

<Limit GET POST>
require valid-user
</limit>


Click File > Save As

Make sure that the bottom dropdown on the save as dialog is set to all files.

Now save this file as .htaccess


Next open a command prompt. Start > Run > Command and then cd to your Apache/bin directory..

Eg. cd c:\apache\bin

Now type htpasswd and you should get a list of all available options..

The encryption that I mention here may or may not work for you, it should but if it doesn't try other combinations of the bold part..

htpasswd -cmb .htpasswd username password

You should be alerted that the file was created.

Now place the htaccess in the directory that you want to protect and place the htpasswd in the directory that you specifed in the htaccess.

Now open your httpd.conf and look for the [color red]AllowOverride[/color] option, change this to

AllowOverride AuthConfig

Restart apache and now try to access the protected directory..

If you have any problems, check your error logs..

Hope this helps

Wullie

sales@freshlookdesign.co.uk
www.freshlookdesign.co.uk
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top