When you sign up for a new web hosting package, you may have a situation where you need to get all the site files ready, in place before transferring an existing domain. Or, you may be adding the domain later and need to work on a temporary URL.
If you have a website that uses includes or with absolute paths in your page code, or run a database-driven CMS such as WordPress, you will ideally want to upload the files and not have to edit the URLs on the server.
This is where you need to edit your hosts file on your computer. The location of this file is:
Mac – Use Finder > Go > Go to Folder and type /private. Select the etc folder and use Get Info to make the folder writeable. The hosts file is in the /etc folder.
PC – C:windowssystem32driversetchosts
You can open and edit the file with TextEdit/Notepad or your favourite text editor. Go to the bottom of the file and enter the IP address supplied by your web hosting company, along with the domain name. Enter this twice, with and without the ‘www’ like this:
Do not remove the localhost references already in the file!
Once you have done this, restart your web servers (I use MAMP) and for good measure, relaunch your browser to start a new session. You should now be able to view your site on the temporary URL or log in to your WordPress admin area and update the theme, add your plugins etc.Website Advice settings, Web design, Website designer, WordPress