• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Tutorial] How to Password Protect a Directory on Your Website

Newbie Spellweaver
Joined
Oct 5, 2008
Messages
30
Reaction score
0
System Requirements

You will need the following before your attempt to password-protect anything is successful.

1. Your website must be running on an Apache web server. (Recommanded WAMP SERVER)
2. Your web host must have enabled .htaccess processing - that is, they allow you to customize your web server environment using localized configuration files called .htaccess files.
3. You must have shell access, either via telnet or Secure Shell (SSH). You should also know how to use telnet or SSH to connect to your web hosting account.

Step 1 : Create a .htaccess file

Use an ASCII text editor like Notepad to create a text file with the following contents:


Code:
AuthName Put a name like AdminCP
AuthType Basic = Leave it like this.
AuthUserFile = Where is your .htpasswd?
require valid-user = The username you choosed on .htpasswd

Your .htaccess should be like this:


Code:
AuthName "Secure Area"
AuthType Basic
AuthUserFile /path/to/your/directory/.htpasswd
require valid-user

Step 2: Save and Upload the .htaccess file in the folder you want to protect like admincp.

Step 3: Set Up the Password File, .htpasswd

Open Notepad and write the username you want and the password you want like this:

Code:
username:password

Example:

Code:
dave:dave

Save your file has : .htpasswd

Now upload it in the directory you put .htaccess


Now you have your directory protected with a username and password
 
DRGunZ 2 Creator
Loyal Member
Joined
Jan 21, 2007
Messages
4,493
Reaction score
161
Well a .htaccess file is pretty basic. an easier way is to just put a blank index.php/html/htm or whatever :p but that's really just for folder directorys (not good protection if they know the file name), anything else is better secured by this :p
 
Newbie Spellweaver
Joined
Oct 5, 2008
Messages
30
Reaction score
0
Thank you for your reply :p
 
Skilled Illusionist
Joined
Aug 27, 2008
Messages
349
Reaction score
25
Easy.

But nice for the beginners =)
 
Legendary Battlemage
Joined
Dec 21, 2007
Messages
645
Reaction score
85
Thanks! I was looking for this!
 
Back
Top