View Full Version : Still Having .htaccess probs...
Hello, I'm a newbie to htaccess's and htpasswd's. BUt I am running Window XP Pro, Apache 1.3 plus php4 with mysql, and for some reason my .htaccess file wont work (wont pop up the window asking for the username and paswd). I beleive I was able to create these docs by making .txt files then renaming in DOS
How does one set the proper directories in XP?
Do I have to chmod them when running them on a local machine?
Here they are:
.htaccess is:
AuthUserFile FTP files/pswds/.htpasswd
AuthGroupFile /dev/null
AuthName chris
AuthType Basic
<Limit GET>
require user chris
</Limit>
.htpasswd is:
htpasswd -c FTP files/pswrds/.htpasswd lala
Let me know Thanks!
chrisvmarle
11-04-2002, 08:04 AM
I got it working on WinXP with directories like "c:/website/.htpasswd" (without the ")
Mzzl, Chris
Originally posted by chrisvmarle
I got it working on WinXP with directories like "c:/website/.htpasswd" (without the ")
Mzzl, Chris
Changed to:
AuthUserFile D:/FTP files/pswds/.htpasswd
AuthGroupFile /dev/null
AuthName chris
AuthType Basic
<Limit GET>
require user chris
</Limit>
--and--
htpasswd -c D:/FTP files/pswds/.htpasswd lala
But STILL to NO avail....no workie....any ideas?
chrisvmarle
11-04-2002, 08:32 AM
Well, I'm not very "into" .htpasswd, but shouldn't a .htpasswd look like this:
username:password
username:password
etc.
And here's my .htacess:
AuthType Basic
AuthName phpMyAdmin
AuthUserFile c:/website/.htpasswd
require valid-user
BTW, what webserver application are you using?
(Mine is Apache)
Mzzl, Chris
Originally posted by chrisvmarle
Well, I'm not very "into" .htpasswd, but shouldn't a .htpasswd look like this:
username:password
username:password
etc.
And here's my .htacess:
AuthType Basic
AuthName phpMyAdmin
AuthUserFile c:/website/.htpasswd
require valid-user
BTW, what webserver application are you using?
(Mine is Apache)
Mzzl, Chris
Did you read my first post? I am running Apache 1.3
They way you have written then do not look like the ones in the tutorials found here:
http://javascriptkit.com/howto/htaccess.shtml
Man, I am still having problems getting .htaccess to work. Seems too friggen easy, just a few lines of code. Anyhow can someone assist me be letting me know what I am doing wrong?
My System:
Windows XP Pro
Apache 1.3
PHP 4
Mysql DB
Every thing works beautifully *EXCEPT* .htaccess and .htpasswrd
Here is what I did: I constructed two .txt files with those two file names (htaccess.txt and htpasswrd.txt). Then I went to the command prompt and renamed them (EG: ren htaccess.txt .htaccess). Then I stuck the .htaccess in the root of my webserver and the .htpasswrd in a separate directory.
Below is the text from those 2 files:
.htaccess is this:
AuthUserFile D:/FTP files/pswds/.htpasswd
AuthGroupFile /dev/null
AuthName chris
AuthType Basic
require valid-user
.htpasswrd is this:
htpasswd -c D:/FTP files/pswds/.htpasswd lala
Now, I have tried to log in (using my IP) via an "outside" computer (not on my network) and apache just lists the directory. It didn't even prompt me for a password at all. Obviously I am doing something wrong....are there chmods that need to happen even with Windows XP?
Sorry for the log post
Can anyone help me?
Tony, you do not need to open a new thread for the same issue, it will not help your thread become more popular, and bogs down CF with erroneous posts.
Try taking out your LIMIT GET and end LIMIT delimiters, some systems/setups have probelsm with this and only need require valid-user or require user username.
Wait, you've already done that...
Your htaccess isn't working at all, even if your htpasswd was improperly formatted, you would still get a prompt for the htaccess authentication (or an error of the 500 nature).
Check your Apache settings and see if you have htaccess disallowed, or htaccess directives. Check your file permissions (though you should have gotten an error if it was that, but I am not sure how your system is setup).
Also, your directory path for the AuthUserFile should be D:\FTP files\pswds\.htpasswd (since you are on a M$ flavor).
And are you sure htpasswd is being spelled correctly? In your example, you typed it out as .htpasswrd when it should be .htpasswd.
chrisvmarle
11-04-2002, 08:09 PM
Sorry for the question about your webserver :p
I think I might have found something that could be errornous, wich is the space in the location name of the files.
I think that's what's wrong, you might try this:
D:/FTPfil~1/pswds/.htpasswd
Maybe it will work, haven't test it.
And by the way the way I use .htpasswd is like described in http://javascriptkit.com/howto/htaccess3.shtml ;)
Mzzl, Chris
Mouldy_Goat
11-04-2002, 10:38 PM
Hi Tony,
Just a couple of points.
1) Your .htpasswd file isn't containing what it should. chrisvmarle is right - it should be in the format of lines each containing:
username:password
where password is an encrypted form of their password.
For example, in the tutorial you cited as having used it gives the example of:
wsabstract:y4E7Ep8e7EYV
There, the y4E7Ep8e7EYV is the encrypted form of the word 'password'. Of course, it's not exactly intuitive what the encrypted form of the word 'password' is - it's actually the standard crypt() function that makes it. What you say you've got in your file:
htpasswd -c D:/FTP files/pswds/.htpasswd lala
Is showing a use of the htpasswd tool you get with the distribution. The manual page for it is here (http://httpd.apache.org/docs/programs/htpasswd.html). If you used that from the command line it would prompt the user 'lala' for a password and would store the encrypted form in the .htpasswd file for you, creating it if it did not exist.
2) I'm really not sure about the space in the file path. Try placing the file in a directory where there are no spaces in the path and trying that instead.
3) You definitely want forward slashes for the path - even though it's a Windows system and you'd usually use backward slashes.
4) To turn automatic directory listing off take a look here (http://httpd.apache.org/docs/misc/FAQ.html#indexes).
5) Take a look at httpd.conf and make doubly certain it's setup correctly.
Also I noticed that your tutorial was a little skimpy on the whole issue.
A better version is available here (http://www.apacheweek.com/features/userauth) - more rigorous and explanatory. If you want a tutorial on doing authentication that is the most thorough and least likely to be error prone take a look here (http://httpd.apache.org/docs/howto/auth.html). Straight from the horse's mouth.
Hope that helps a bit.
Originally posted by Feyd
Tony, you do not need to open a new thread for the same issue, it will not help your thread become more popular, and bogs down CF with erroneous posts.
Try taking out your LIMIT GET and end LIMIT delimiters, some systems/setups have probelsm with this and only need require valid-user or require user username.
Wait, you've already done that...
Your htaccess isn't working at all, even if your htpasswd was improperly formatted, you would still get a prompt for the htaccess authentication (or an error of the 500 nature).
Check your Apache settings and see if you have htaccess disallowed, or htaccess directives. Check your file permissions (though you should have gotten an error if it was that, but I am
not sure how your system is setup).
Checked my apache (httpd) settings and here it is:
I have looked into my httpd.conf file(is it correct?) and it says this:
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
# Under Win32, we do not currently try to determine the home directory of
# a Windows login, so a format such as that below needs to be used. See
# the UserDir documentation for details.
#
UserDir "C:/Program Files/Apache Group/Apache/users/"
#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
DirectoryIndex index.html index.htm index.php
#
# AccessFileName: The name of the file to look for in each directory
# for access control information.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files. If you change the AccessFileName directive above,
# be sure to make the corresponding changes here.
#
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
Also, your directory path for the AuthUserFile should be D:\FTP files\pswds\.htpasswd (since you are on a M$ flavor).
The post right below you (Mouldy_Goat) says to use FORWARD slashes........hmm, what is it. I =
And are you sure htpasswd is being spelled correctly? In your example, you typed it out as .htpasswrd when it should be .htpasswd.
Yes it is spelled properly, sorry
Just wanted to let you know that I got it.
.htaccess:
AuthName "XXXX"
AuthType Basic
AuthUserFile "c:/program files/apache group/apache/htdocs/.htpasswd"
require valid-user
Thanks for all the help by the way
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.