Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

.htaccess file

by chuleto1 (Beadle)
on Sep 12, 2002 at 23:08 UTC ( #197387=perlquestion: print w/replies, xml ) Need Help??

chuleto1 has asked for the wisdom of the Perl Monks concerning the following question:

Ok Monks here is the skinny:
I installed apache on a linux box. I want to set a directory that only permits access via password. This is what my .htaccess files looks like:
AuthName "this is neat" AuthUserFile /the_path_to_to_the_file/.htaccess require valid-user
I created my .htpasswd file with an initial password. When I go to the location of the .htaccess file via http://localhost/passpwordprotecteddir/page.html, nothing happens! I can still get to that directory and view the html page , NO PASSWORD PROTECTION TAKES PLACE. Is anyone familar with .htaccess files? Does apache server need to be configured for this?

Replies are listed 'Best First'.
Re: .htaccess file
by jlongino (Parson) on Sep 13, 2002 at 00:07 UTC
    As AM stated, find the httpd.conf section that controls the htdocs section:
    <Directory "/usr/local/apache/htdocs"> . . AllowOverride None . . </Directory>
    and change "None" to the combination you want. Minimally:
    AllowOverride AuthConfig
    Be sure you get the htdocs section, you probably don't want to mess with the section:
    <Directory /> Options FollowSymLinks AllowOverride None </Directory>


Re: .htaccess file
by tstock (Curate) on Sep 13, 2002 at 00:03 UTC
    I think you are missing some things in your .htaccess. Here's how it's supposed to look like:
    AuthName        "this is neat"
    AuthType        Basic
    AuthUserFile    /usr/www/users/tstock/.htpasswd
    <Limit GET POST>
    require valid-user
    Note the AuthUserFile points to a .htpasswd, not .htaccess, and that the path is a file path, not a URL.

    To create your .htpasswd file, use the command `htpasswd -c .htpasswd username_here` from the shell. The -c flag is only needed for the first user.

      Actually the AuthUserFile can be any name you give it (by substituting ".htpasswd" with ".whatever_you_wanna_call_it" in the shell command when you create the file) just be sure to include that dot at the beginning of the name as a security measure:)
Re: .htaccess file
by Anonymous Monk on Sep 12, 2002 at 23:29 UTC
    yes and yes.
    You have to mess with the http.conf file thingy.
    Sorry I couldn't be more helpful but this site mainly a Perl site.
      That was I neede to know. Thank you, you geve me enough information to get it to work.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://197387]
Approved by Zaxo
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2023-06-04 10:44 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (20 votes). Check out past polls.