Google
 
 
Home arrow Apache Articles arrow Apache .htaccess

Main Menu
 Home
 Linux Articles
 FreeBSD Articles
 Apache Articles
 Perl Articles
 Other Articles
 Program Downloads
 Free Books
 News
 The Web Links
 Contact Us

Most Read
Automating SFTP using expect
FreeBSD PPTP VPN
Shorewall Router on Linux
SnortShorwall - Using Snort And Shorewall Together
Shorewall Stand Alone Firewall

Polls
Favorite Linux/BSD
Fedora
Mandrake
Debian
Slackware
Gentoo
Suse
FreeBSD
Other
  

Syndicate
Latest news direct to your desktop
RSS

Login Form
Username

Password

Remember me
Forgotten your password?
No account yet? Create one

Members Online
 Linux-BSD-Central Has a Total of 701 Members   Members (701) # Online
 We have 7 Guests Online. Guests 7
 We have 0 Users Online. Users 0

Online Users
No Users Online

Statistics
OS: Linux w
PHP: 5.2.9
MySQL: 5.0.91-community
Time: 14:38
Members: 701
Hits: 1324412
News: 277
WebLinks: 15



-->

Apache .htaccess   PDF  Print  E-mail 
Contributed by Chad Brandt  
Thursday, 17 June 2004
Learn how to use .htaccess file to password protect all or parts of your website

1. create a .htaccess file. The .htaccess file should look something like this:

AuthUserFile /usr/local/www/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
Require user chad

This file says that a user chad will authenticate against password file /usr/local/www/.htpasswd

Place this file in the directory you want to password protect. In my example I am securing the cgi-bin directory


2. Create the password file

[root]# htpasswd -c /usr/local/www/.htpasswd chad

This will prompt you for a password for user chad and save your password to the file.


3. Edit your httpd.conf to deny from all. You can see the values I commented out and the values I put in the place


    #AllowOverride None
    Options None
    AllowOverride AuthConfig
    #Order allow,deny
    Order deny,allow


4. Restart apache. When you attempt to access any file in the cgi-bin you will be prompted for your user name and password

Comments

Write Comment
Name:Guest
Title:
BBCode:Web AddressEmail AddressBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
Comment:



Powered by AkoComment 1.0 beta 2!




 
Google Ads



 

Check out TwistByte - The best mobile apps available For awesome Android and IPhone applications!!