How To Make A Site Password Protected


"Enter Password"

“Enter Password” (Photo credit: Wikipedia)

Step 1:Go to any site which generates md5 hash code[example I use http://shop.alterlinks.com/htpasswd/htpasswd.php

Step 2: Write down the username you want to put & generate the hash code

Step 3: Login to the root directory of your file server

Step 4: Go to the secret sub-directory [using cd secret and if doesn’t exist then create new one using mkdir secret in unix command]

Note : secret(can be any name) is the directory (advisable to keep this file outside of your projects main directory) where a file named as passwd(can be any name) reside and this file contains your hash code generated in earlier step.

Step 5: Open the file with name passwd [using pico ,nano,emacs command etc]

Step 6: Put the username & respective hash code in the file and save the file.

your hash code look like myusername:UkQ2z/s0ysn4g

Step 7: Open your domain that you want to make password protected [cd domainname in unix]

Step 8: because in unix {.files} are hidden that’s why it won’t show the .htaccess file ,but you can open the file [using pico .htaccess ]* I use pico

Step 9: put the under quotation code at the very first of the files before any code.

AuthType Basic
AuthName "Restriction for Search Engines"
AuthUserFile /home/ts_allsites/secret/passwd
Require user yourusername

*make sure you are in right host under right user

Step 10: now you can check your site is password protected.

Enjoy!!

Tagged with: , ,
Posted in PHP
One comment on “How To Make A Site Password Protected
  1. valerian tea says:

    It’s amazing in favor oof mme to have a web page, which is useful in support of my experience.
    tthanks admin

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

Follow me on Twitter

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 442 other followers

%d bloggers like this: