Results 1 to 7 of 7

Thread: .htaccess on win32

  1. #1
    Join Date
    Oct 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default .htaccess on win32

    Code:
    AuthName "View ReadMe For Access"
    AuthType Basic
    AuthUserFile C:\wamp\.htpasswd
    AuthGroupFile /dev/null
    require user admin
    My server is set up so everything is in me WWW folder like this C:\wamp\www\index.php

    But when I try to access a password protected area it can't seem to find the .htpasswd file to match the user and pass so no one can view the area.
    I have done this before and worked, the only difference was I used Linux and now I am using WinXP so the only conclusion I can think of is my AuthUserFile is pointing to the wrong file which it isn't.

    Any and all help appreciated.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Are you sure you named it .htpasswd? Windows doesn't usually like "odd" filenames (things with a full stop as the first character, for example) and a lot of programs will attempt to append their own extensions (.htpasswd.txt, for example).

    Also (I'm not very familiar with Apache on Windows, so this may be entirely wrong) but I don't believe /dev/null exists on Windows.
    Last edited by Twey; 01-03-2007 at 09:36 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by Twey View Post
    Are you sure you named it .htpasswd? Windows doesn't usually like "odd" filenames (things with a full stop as the first character, for example) and a lot of programs will attempt to append their own extensions (.htpasswd.txt, for example).
    This is true, but there is a fix around it. To make it to where you can make .ht* files you would need to go to any folder on your computer. At the top, click on "Tools", then "Folder Options". After that, click on the "View" tab at the top and in there find a checkbox with the following option next to it:

    Hide extensions for known file types.
    Uncheck the box, click "Apply" or "OK" (either will save the setting), then try making a .ht* file.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Oct 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks but my .ht files seem to be fine.

    Also (I'm not very familiar with Apache on Windows, so this may be entirely wrong) but I don't believe /dev/null exists on Windows.
    I was wondering about that too since windows uses slashes going the other direction usually, I don't even know what it's for though, is it safe for me to remove it?

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    /dev/null is a device file on Linux that simply discards all data written to it. Anything read from it will be empty. If you want to simulate the effect, try creating a blank file and pointing to that (the correct analogue on DOS/Windows is the device NUL, but I've no idea how one would refer to it).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    You say you have it set up as thus:

    My server is set up so everything is in me WWW folder like this C:\wamp\www\index.php
    Yet your htaccess file (check for the .htaccess.txt problem here too, not just your .htpasswd) says:

    AuthUserFile C:\wamp\.htpasswd
    if your passwd file is ALSO in the WWW folder you need to tell it so


    <edit>
    Looking at my own .htaccess files I saw a couple differences... might be nothing, but try this:

    # Begin password protection #
    AuthName "View ReadMe For Access"
    Require valid-user
    AuthUserFile C:\wamp\.htpasswd
    AuthType basic
    # End password protection #


    </edit>
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I found that under Apache 2, in Windows, it uses a more standard algorithm for the passwd. This web (http://www.htaccesstools.com/htpasswd-generator/) uses the MD5 algorithm, and it works on my system, whereas the algorithm in this web didn't work.

Bookmarks

Posting Permissions

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