Editing Local Hosts File On PC
Editing Local Hosts File On PC
A good cheat for viewing a website before it is live on a server is to add an entry to your Host file on your PC. This file bypasses the DNS so you can view the site whilst it's still in development.
On Windows
1. Open Notepad with Administrative privileges by clicking Start, All Programs, Accessories, and then right-click Notepad and select to run as Administrator.
2. Now that Notepad is open with Administrative privileges click the File menu then click Open
3. Browse to (C:\Windows\System32\drivers\etc)
4. Then click show all files in bottom right drop down.
5. Open the hosts file.
6. You can edit the file by placing your IP and host below the last line and save the file.
7. Now you can test your sites as if they were live. If you clear your browser cache and browse to the domain. You may need to clear your browser cache if you still see the old site.
Note: To go back to using the public DNS you need to revert the changes made to your local host file. To do this, do the exact same steps above, but remove the new entries you made, then save as detailed in step 6. You may need to clear your browser cache once again not ensure everything is fresh.
NB: If you entered www.example.com in your host file, you'll need to browse to www.example.com.
Example.com would still show the current live site unless you also place this in the hosts file.
Updated 3 months ago