How to secure your page using .htaccess

htaccess

Want to have a secure page and prompt your user with this login window? 🙂

I have setup ntop previously and I have to secure the page using .htaccess and .htpasswd file.

The process is quite simple atually, you can just have FTP access to set this things up. At first you have to create your .htaccess file. The format of your file is like below:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/local/html/.htpasswd
AuthGroupFile /dev/null
require valid-user

The file above will find the .htpasswd file, where it will contain your encrypted password. Below is the sample of .htaccess file with password mypassword:

farhan:VQv2aMigXGMkU

Upload them to your folder. You should put your .htpasswd out from the apache accessable file. Your user might just view your encrypted password easily, and make sure the path of .htpasswd in .htaccess file is correct. Upload them using ASCII instead of Binary.

You can use this website to create your .htaccess and .htpasswd files. It can generate the encrypted password for you.
http://www.tools.dynamicdrive.com/password/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.