directory protect  htaccess htpasswd

If you want to protect a directory on your website, it's easy with dirprotect.Get more info ?

Here are all the Steps to protect a directory with your own values :

Step 1) Create a directory called example into your computer :

Step 2) Create the code of the file .htaccess :
You need to know your server path to complete the code, so, create a file call mypath.php with Notepad and put into this file this php code <?php echo realpath('mypath.php'); ?>
Send this file to your website (with ftp software) and go to http://yourwebsite.com/mypath.php , on your screen appears a path like this : /home/websiteinfo/yourwebsite.com/mypath.php
or could be shorter, longer (depend on hosting configuration)
To only protect the directory example just complete the path to get something like this /home/websiteinfo/yourwebsite.com/example/ and put the path into this input below


Step 3) Create the code of the file .htpasswd :
The content of this file is just a line like this : username:password with a crypted password

username

password

(This form crypt your password too)

Step 4) SO WE HAVE FINISHED !!!
Just send all the directory example (which contains the 2 files) to your website and add as many as you want others files into this directory. When you will go to the url : http://yourwebsite.com/example/afile.html or another files of this directory you will have to enter a username and password to access to the area. (Tips : i recommend to always add a file index.html (with example just a text : hello), into the directory you want protect, some server need it to work.)

Add Dirprotect to your favorite ?

© 2009 - Dirprotect.com - Contact