If you are working on a website and want only selected people to access it,then the best option is to password protect the site or the root directory.This could be done easily by placing two files in the directory, .htaccess and .htpasswd.
AuthName "restricted area"
Place the code in a text file and name it “.htaccess” and place it in the directory you want to password protect.Also note that the AuthUserFile should have the absolute path to the directory.It will be like /home/user/public_html/website/subdirectory/.htpasswd
You should be able to to echo out a phpinfo(); on a page in that directory to scope this directory out.
“.htpasswd” file should have one username and password per line separated by a colon.Place this file in the same directory as “.htaccess” file.After placing both the files your directory or website will be password protected.