deutsch   english

Domains

Domains for sale!

Short and catchy domains are very rare.

9b9.de
pik7.net
rapidlinks.de
rapidlinks.net
rapidlinks.eu
Show available domains...

last update 08.Sep.2010
Rate this site:

Password protection

Website password protection with htaccess

Password protection for website directories with .htaccess and .htpasswd

The following Password generator creates a directory protection using .htaccess for websites, which are running under the Apache Web server. As a result, a dialog box appears and prompts to enter a user name and password, everytime a visitor tries to have access to this protected directory, or to a file inside this directory. The condition is that your provider allows you the use of .htaccess - what is normally the case.

Step 1:
Create a text file called .htpasswd (don't forget the dot!) inside the directory, which you would like to protect and insert the following generated text into this file. You can choose between 2 types of encryption (DES and MD5) if one type do not work in your system:

PASSWORD GENERATOR (max. 100 chars)
(max. 100 chars)
Encryption with Salt-2
Encryption with Salt-12

This server does not store any data !

Hint: you can add more than one user into the .htpasswd. Simply repeat to enter User name and Password and press the button Generate.

 

Step 2:
Create a text file called .htaccess (don't forget the dot!) inside the directory, which you would like to protect and insert the following content:

AuthType Basic
AuthName "Protected Area"
AuthUserFile /path to/directory/.htpasswd
Require user Username1 Username2 Username3

Don't forget to insert your real path and user name(s)!

Explanation:

  • "Protected Area" - any text string of your choice.
  • "/path to/directory/.htpasswd" - the real path to the protected directory which contains the file.htpasswd. Don't forget the leading slash ("/") !
  • "Username1", "Username2" - Name of user(s), which will become access to the protected directory.

 

Step 3:
Use your FTP-software to change the file permissions of .htaccess and .htpasswd with CHMOD 644.

 

Determine the real path with PHP:

Create a text file called phpinfo.php and insert the following content:

<?php
phpinfo();
?>

Copy the file to your webspace and execute it in your browser. The PHP-script will show a long configuration list. Find the line which starts with DOCUMENT_ROOT. That's the real path to the root(!) directory of your webspace. e.g.: /var/www/domain/flazh/httpdocs.
Now you have to attach all subdirectories and the file .htpasswd to this path. e.g.: /var/www/domain/flazh/httpdocs/protecteddirectory/.htpasswd

Attention: don't forget to remove the file phpinfo.php from your webspace, because other bad guys could use this script to find weak points or security holes inside the PHP-configuration!
Digg Google Delicious Wong Yahoo Stumbleupon Windows Live Technorati Facebook Twitter Webnews Yigg Blinklist
User-Comments: Password protection

quiero mas!!! muy buena la pagina saludos desde argentina

jorge 18.Dec.2008 03:02
USER COMMENT
(invisible)


top