Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: Password Protect/.htaccess

  1. #11
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Originally posted here by philman213
    Sorry I just get very pissed off and frustrated when things dont work right, especially when it has to do with computers.
    Computers are funny things. They do exactly what you've told them, nothing more, nothing less. If something goes wrong it's because you made a mistake. Don't take it out on us and/or your computer.

    I hate to ask but did you RTFM?

    You didn't mention what version of apache you're running so here's some documentation on both:

    Authentication, authorization and access-control (version 1.3)
    Authentication, authorization and access-control (version 2.0)
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  2. #12
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    DocumentRoot "/usr/local/apache2/htdocs"

    #
    # Each directory to which Apache has access can be configured with respect
    # to which services and features are allowed and/or disabled in that
    # directory (and its subdirectories).
    #
    # First, we configure the "default" to be a very restrictive set of
    # features.
    #
    <Directory />
    Options FollowSymLinks
    AllowOverride AuthConfig
    </Directory>

    #
    # Note that from this point forward you must specifically allow
    # particular features to be enabled - so if something's not working as
    # you might expect, make sure that you have specifically enabled it
    # below.
    #

    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/usr/local/apache2/htdocs">

    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important. Please see
    # http://httpd.apache.org/docs-2.0/mod/core.html#options
    # for more information.
    #
    Options -Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # Options FileInfo AuthConfig Limit
    #
    AllowOverride AuthConfig

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

    </Directory>
    first make sure the bolded things from above are in your httpd.conf file. Yours will be a little different being windows, but the change is still the same. Then do like ;TT said and use the htpasswd.exe tool to make your user and pass.
    ex. (summarizing what ;TT said)

    Type "htpasswd -c C:\Program Files\Apache Group\Apache2\auth\htpasswd user_name"
    without the quotes. It will prompt you for the password. Enter the password. This will create the file the .htaccess file will use to authenticate. I don't know if that directory is right for the default install, but I think it is.

    Now make the .htaccess file and save it to the directory you want to require the username and pass to access.
    ex.

    AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile c:/Program Files/Apache Group/Apache2/auth/htpasswd
    Require user user_name

    like ;TT said to get it to save as .htaccess you have to put quotes around it like ".htaccess"
    once that is done, you just need to restart apache, and it should prompt you for a user and pass when trying to access the directory with the .htaccess file in it. Hope this gets you over the hump you couldn't get over from the other info. I think they left off about the config change in apache, but I'm sure it was on one of the websites posted and that's why they left it off. Try and read more next time. Peace.

  3. #13
    Banned
    Join Date
    Aug 2001
    Location
    Yes
    Posts
    4,424
    Maybe it's time to ask a basic question first:
    Are you running your own server? If yes, which one and on what OS?...
    If no, you're talking about your webhost?

  4. #14
    Just a Virtualized Geek MrLinus's Avatar
    Join Date
    Sep 2001
    Location
    Redondo Beach, CA
    Posts
    7,323
    I've re-opened this thread at the request of one of the posters. If it gets closed again due to APs, it will stay closed. 'Nuff said. Carry on.
    Goodbye, Mittens (1992-2008). My pillow will be cold without your purring beside my head
    Extra! Extra! Get your FREE copy of Insight Newsletter||MsMittens' HomePage

  5. #15
    Member
    Join Date
    Apr 2004
    Posts
    91
    Maybe Im making the files wrong then. How exactly am I suppose to make them. Make a new notepad file and save as ".htaccess" and ".htpasswd"?

  6. #16
    Member
    Join Date
    Apr 2004
    Posts
    91
    Attached is what happens when I try and do the -c blah blah stuff.

  7. #17
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    Did you create the folder auth? If not that may be the problem. Try making that folder then retry that command. Hope that works. And if this thread gets closed and you have questions just pm me. Peace.

  8. #18
    Member
    Join Date
    Apr 2004
    Posts
    91
    No, I have auth already created.

  9. #19
    Banned
    Join Date
    Sep 2004
    Posts
    305
    Add quotes around the location, so htpasswd -c "C:\whatever\auth\htpasswd" user_name

  10. #20
    Member
    Join Date
    Apr 2004
    Posts
    91
    Alright I have the htpasswd created in the auth directory. Now my understanding is to leave that, and create a htaccess file in the folder i want people to have to have a user/pass to access. How do I go about creating the htaccess file?

    Edit:
    I get the following after opening notepad and making the .htaccess file in the folder I wanted. This is what I have for my .htaccess file...
    AuthType Basic
    AuthName "Secured Directory"
    AuthUserFile C:\Program Files\Apache Group\Apache2\auth\.htpasswd
    Require valid-user


    And this is the error I get...

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, *********** and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.


    --------------------------------------------------------------------------------

    Apache/2.0.51 (Win32) Server at **********.ath.cx Port 80

Posting Permissions

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