Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts

    .htaccess/.htpasswd Files not working

    I'm running Apache 2.0 on Windows XP and have a .htaccess file in one of my directories. And it contains:
    Code:
    AuthUserFile .htpasswd
    
    AuthName Relay01
    AuthType Basic
    
    require valid-user
    And the .htpasswd file is in the same directory as the .htaccess file. And when I try to access the directory through the browser, it pops up with a login dialog like it should, but even when I enter in username and passwords that I know are good, it doesn't accept them.

    The .htpasswd of course has the username and encrypted passwords.

    What is wrong? It is hard to figure it out since all the tutorials on .htaccess I've found are for Linux only.
    OracleGuy

  • #2
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    404
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Some win machines have problems with files beginning with .. The file is there, which is why it doesn't error out, but the system doesn't recognize it. More than a few people who want to run Apache on Windows often setup their htaccess/htpasswd files as ht.access and ht.passwd and then update the httpd.conf file:

    AccessFileName .htaccess
    to
    AccessFileName ht.access

    and

    <Files ~ "^\.ht">
    to
    <Files ~ "^ht\.">

    This typically resolves the problem.
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #3
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Well I would be willing to bet the problem lies with the fact that you didn't specify the location of the .htpasswd file.

    Since you are on a windows machine your path will look something like this:

    AuthUserFile C:\www\protecteddirectory\.htpasswd

    AuthName Relay01
    AuthType Basic

    require valid-user
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    I did both things and it didn't resolve the problem.

    Any other ideas?
    OracleGuy

  • #5
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    I copied and pasted the contents of your htaccess file and ran it on my machine running Apache 1.3 on WinXP and it works fine.

    Do you have your .htpasswd file set up like this?

    username:password

    Oh yeah and undo what feyd suggested so we are at least working under the same condition. Those changes are not needed in this situation.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #6
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    I re-did the .htpasswd file using the program included with apache. I was using this one site that had the feature, http://www.euronet.nl/~arnow/htpasswd/

    But it guess it isn't compatible. Nevertheless, I got it working. Thanks guys.
    OracleGuy

  • #7
    New Coder dragon's Avatar
    Join Date
    May 2003
    Location
    Florida
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oracleguy, Is the program you used available on the web? I've been having a problem getting .htpasswd to work also and I was using that same password generator.

  • #8
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    The program should come with apache. It is in the bin folder and called htpasswd.exe

    You run it from the command line.
    OracleGuy

  • #9
    New Coder dragon's Avatar
    Join Date
    May 2003
    Location
    Florida
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not running the webserver myself. I've already asked the host admin and they said that I don't have access to it. They said that I should be able to put in the password just like normal (without encoding it) but that doesn't seem to work either.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •