When building a new website there is a number of ways in which you can allow the user to see the site before launch. The way in which I tend to prefer is once the site is live give the client the a record and request them to change there host file so they can get to the site. However not all people have the ability to change there host file. My fallback process is get the user IP Address and add it to htaccess file.
Go to your project folder and create a file called .htaccess and open it in your editor. If you already have a .htaccess file open it up in your editor.
In the file paste in the following below at the top of the .htaccess
Order deny,allow Deny from all
Now we need to get the IP address for the user. If this is not known you can ask the user IT department to provide this alternatively it can be done by doing Google Search “what my ip” and Google will provide the public IP address.
Now under Deny from all add in the following:
Allow from MY-IP
The site should now only be viewable with user’s added to the htaccess file. To add multiple Ip Address just add each one to a new line. This isn’t my prefered method of letting a user preview a site but it’s a good alternative to use.