You may want to restrict the development site from search engine or from direct access. Here we will be discussing on how to password protect your development site which makes a use of Magento .htaccess & .htpasswd files.
Step 1: Use FTP or Cpanel to access the folder containing magento code.
Step 2: Open Magento .htaccess file then insert following code (on top of it).
AuthName "User: admin. Password: admin123"
AuthUserFile /patch/to /.htpasswd
AuthType Basic
require valid-user
ErrorDocument 401 "Authorisation Required"
in which AuthUserFile must exactly call to server’s link (to see the full link, you can use ssh, access to the folder containing code then type pwd to command. Another way is to create a testing file and use code <?php echo $_SERVER[‘DOCUMENT_ROOT’];?> to see full link. For instance, AuthUserFile /home/user/domain.com/.htpasswd
Step 3: Create a file .htpasswd at the same level with file Magento .htaccess (not compulsory at same level, however, the link must be correct).
Step 4: Go to the address http://www.htaccesstools.com/htpasswd-generator/ to setup username and password as you want. After that, copy the outcome.
Step 5: Open file .htpasswd again and paste the copy. Now save it and you can get back to the site to check.
That’s it. Only 5 simple steps above, you can totally create password to protect your development site.