Steps to password protect your web page

Steps to password protect your web page

  1. Bhawani Singh
    Configuring the web page and protecting it with the help of password is quite an easy way. The webmasters will be protecting their web page and mainly the directory which contains all the information and they make it visible only to few selected peoples they wanted to share the information.

    It can be easily protected if your web page has a control panel. You can always check the control panel to know the status of the web page and we can also know if they already provide the facility to protect the information directories. This protection can be developed using the Apache’s built-in facilities.

    Some of the commercial sites will already provide the easy way to protect the information. If such an option is available, it is better you can also use it and probably it will be the best and saves your time and particularly if you don’t know the use of shell commands and the editing of .htaccess files.

    The following should be required before we try to protect the information directories…

    1. You have to make sure that your web site must be running on an Apache web server.

    2. The .htaccess process must be enabled in the web host, because they allow you to customize the server environment using files called the .htaccess files.

    3. Make sure you have the shell access either by the telnet or via Secure Shell (SSH) and you should be knowing how to use the telnet or the SSH to your web hosting account.

    These are the following steps that is to be followed to protect the web page using password..

    Set 1: Create a .htaccess file. You can use a plain text editor or a notepad to create the text file with the following commands.

    Code:
    AuthName “Secure Area”
    AuthType Basic
    AuthUserFile /path/to/your/directory/.htpasswd
    require valid-username
    Set 2: Save and upload the .htaccess file. Make sure to save the file as “.htaccess” including the quotes if your are using notepad, otherwise the notepad will change the file as “.htaccess.txt”

    Set 3: Then upload the saved file to the directory which you wanted to protect. Now, set up the password file .htpasswd

    Set 4: You should use your telnet or SSH software to log into your created chell account. When you are logging in, you should make sure that you are in your home directory and not somewhere else.

    Set 5: Then type the following commands: htpasswd –c .htpasswd your-user-name. Here, your-user-name will be the login name of the user that you want to give access.

    Set 6: If you have more than one user you wanted to give access to, then use the following command

    Code:
    htpasswd .htpasswd another-user-name
    Set 7: If you want to know the contents that is being saved in the directory, use

    Code:
    cat .htpasswd
    Note: Once the files are being setp, you can try testing your setup using your browser to make sure that everything works as per the commands. To check you can simply upload an index.html file to check the directory.

    You have now successfully protected your website with the password protection.