How to limit access to your website with apache2

From ThorstensHome
Revision as of 09:09, 18 October 2008 by WikiSysop (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To get your apache2 protect a webpage with a password:

  1. have an unprotected webpage that shows up in your browser (I assume it is stored in /home/httpd/prot)
  2. create a .htpasswd file with htpasswd2
  3. create a file named .htaccess in /home/httpd/prot:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/httpd/prot/.htpasswd
Require valid-user
  1. in your httpd.conf, replace all AllowOverride none with AllowOverride all. Read what AllowOverride is good for (