Secure directory with password using .htaccess and .htpassword

Posted: July 3, 2013 in web

if you wanted to secure the folder /var/home/html/secureme/

create two files:

1. .htaccess

AuthType Basic
AuthName “restricted area”
AuthUserFile /var/home/html/secureme/.htpasswd
require valid-user

2. .htpassword

user1:temjCCsjBECmU  –> password needs to be MD5 which is equivalent to “test123”

Upload both files under /var/home/html/secureme/ and you should be all set.

To check your home directory, use phpinfo() and look for document root.

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s