Page 1 of 1

find .htaccess password directory

PostPosted: 19. March 2005 06:13
by hgtwn
I am trying to set up .htaccess using xampp-windows. my website is located at http://127.0.0.1/mysite/index.php and i put both the .htaccess and .htpasswd files in the mysite folder. I need help specifying what directory to find the .htpasswd file on the server. no matter what i put as the address it doesn't find it. also, it doesn't seem to find any of the error pages either, they are both in the same "mysite" dir too. any suggestions? here is my .htaccess text:

ErrorDocument 404 /notfound.html
ErrorDocument 401 /login.html
AuthName "Restricted Site"
AuthType Basic
AuthUserFile /.htpasswd
Require valid-user

thanks for the help!

hgtwn

Re: find .htaccess password directory

PostPosted: 19. March 2005 07:40
by petitprince
hgtwn wrote:I am trying to set up .htaccess using xampp-windows. my website is located at http://127.0.0.1/mysite/index.php and i put both the .htaccess and .htpasswd files in the mysite folder. I need help specifying what directory to find the .htpasswd file on the server. no matter what i put as the address it doesn't find it. also, it doesn't seem to find any of the error pages either, they are both in the same "mysite" dir too. any suggestions? here is my .htaccess text:

ErrorDocument 404 /notfound.html
ErrorDocument 401 /login.html
AuthName "Restricted Site"
AuthType Basic
AuthUserFile /.htpasswd
Require valid-user


Assuming you have an XAMPP standard installation, the .htaccess file of your scenario would read

Code: Select all
AuthType Basic
AuthName "Restricted Site"
require valid-user
AuthUserfile "../htdocs/mysite/.htpasswd"


It's the ServerRoot, not the DocumentRoot that is relevant!

petitprince

PostPosted: 19. March 2005 08:03
by iliad2b
this might help

at SCHOOL my home directory is blah and thus i have a file called

.htpasswd

in that file i have blah:encrypted password which is created automatically by CREATING .htpasswd using the following when login to my home directory:

htpasswd –c .htpasswd username

that command creats .htpasswd and the first user

then, then,

i create www folder with 777 permissions and inside that folder i have .htaccess file with the following stuff in it.

AuthUserFile /blah/.htpasswd
AuthGroupFile /dev/null
AuthName "school.edu me" // me = same name as the first user that was setup
AuthType Basic

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

hope that helps

just remember that .htpasswd goes one level up from the .htaccess file, they both DO NOT go in the same directory.

example directory:
c:\blah\.htpasswd
and
c:\blah\www\.htaccess

PostPosted: 19. March 2005 16:02
by hgtwn
petitprince, i do have standard installation and everything works on xampp but this feture it seems. I changed the file name to be what you said and it still did not work. I keep getting the password box to pop up but no matter what password i type in, it just keeps popping up. it is like it isn't finding the .htpasswd file so it doesnt know what the username and password should be.

right now i'm using AuthUserFile "../htdocs/mysite/.htpasswd" and it doesn't work. both my .htaccess and .htpasswd files are in the mysite folder. Any suggestions?

I got the error documents working, i guess my path for those was wrong. it should have been "/mysite/404.

hgtwn

PostPosted: 19. March 2005 23:18
by petitprince
Maybe you forgot to "MD5" your passwords with htpasswd.exe?

petitprince

PostPosted: 20. March 2005 04:13
by hgtwn
petitprince wrote:Maybe you forgot to "MD5" your passwords with htpasswd.exe?
petitprince


yeah, i was using a password generator that i found on the internet to make me an encripted password and that didn't work. for some reason, when i used the htpasswd.exe it decided to work. so its all up and running now! thanks for the continual help with this.

hgtwn