...

View Full Version : .htpasswd issue



nikos101
11-19-2007, 11:28 AM
Hi I have a site locally at

C:\xampp\htdocs\cms\

I have a .htpasswd file at C:\xampp\password\
the .htpasswd file contains wsabstract:y4E7Ep8e7EYV

My .htaccess code is stored at

C:\xampp\htdocs\cms\

and contains


Options -Indexes
DirectoryIndex index2.php
AuthName "Section Name"
AuthType Basic
AuthUserFile C:/xampp/password/.htpasswd
Require valid-user

when I go to http://localhost/cms/ I get an error 500 instead of a password prompt.

Any advice?

_Aerospace_Eng_
11-19-2007, 03:48 PM
The password can't be encrypted if you are running xampp on windows. Everything else looks fine though. Try this
htaccess

AuthName "Section Name"
AuthType Basic
AuthUserFile C:/xampp/password/.htpasswd
Require valid-user
Options -Indexes
DirectoryIndex index2.php

abduraooft
11-19-2007, 04:44 PM
The password can't be encrypted if you are running xampp on windows. Everything else looks fine though. Try this
htaccess

xampplite\apache\bin\htpasswd.exe creates an encrypted password.

I've done this in windows, but missed the tutorial link. Anyway I think the steps are as follows.
0)Backup your xampplite\apache\conf\httpd.conf ;)
1) Add the below portion in to this

AccessFileName .htaccess
<Directory "/xampplite/htdocs/myfolder/admin">
AllowOverride All
Options None
Order deny,allow
</Directory>
under a line DocumentRoot "/xampplite/htdocs"
2) Take command promt and run

xampplite\apache\bin\htpasswd.exe -c .htpasswd username
this will create a .htpasswd file in your working directory.
3)Copy this file to htdocs/myfolder/admin
4)then create a .htaccess file in your folder to be protected having something like

AuthUserFile C:/xampplite/htdocs/myfolder/admin/.htpasswd
AuthName "This is protected area"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>

(Change folder name to fit to your system)
5)Restart apache.
:thumbsup:

nikos101
11-19-2007, 07:03 PM
Well done Aero, that worked nicely, although I'm not sure why it made a difference.

Also thanks to abduraooft where your post could really help me in the future.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum