Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

.htaccess file

by chuleto1 (Beadle)
on Sep 12, 2002 at 23:08 UTC ( [id://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?
-thanks

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>

    --Jim

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
    </Limit>
    
    
    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.

    tstock
      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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-18 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found