PHP 32
Htaccess password protection By micha on 22nd November 2018 03:47:32 PM
  1. .htaccess
  2. AuthType Basic
  3. AuthName "Password Protected Area"
  4. AuthUserFile  /var/www/html/.htpasswd
  5. Require valid-user
  6.  
  7. .htpasswd
  8. micha:$apr1$2cGB44M5$WHX.GjwxyjDm9KeJjUXS1/
  9. timo:$apr1$VZdMh.J/$wlVg50QesIV5XyFBuuG6/1
  10.  
  11.  
  12. AuthUserFile needs the full path, check path in your phpinfo() or with the following
  13.  
  14. <?php
  15. $dir = dirname(__FILE__);
  16. echo "<p>Full path to this dir: " . $dir . "</p>";
  17. echo "<p>Full path to a .htpasswd file in this dir: " . $dir . "/.htpasswd" . "</p>";

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.