=========
QUESTION
———
I need to edit my local HOSTS file to redirect my web requests for my web site to my development server rather than the live web server, how do I do this?

 

=========
ANSWER
———
WINDOWS

Using Windows Explorer, browse to
C:\windows\system32\drivers\etc\hosts\
(older versions of windows go to: C:\windows\hosts\)

Locate the file titled “hosts”
Right-click the file, left-click Properties
Select the Security tab, click the Edit button
Select the “Users” group, and check the “Modify” box in the Permissions For Users section below
Click OK, OK

Double-click the “hosts” file to open it, and select Notepad from the Open With program list.

Add the following line to the bottom of the file:
173.248.154.36 anySiteHosting.com

(replace 173.248.154.36 with your web site’s IP Address, and replace anySiteHosting.com with your web site’s domain name)
Save the file

Now close all web browsers, open a new web browser, type in your web site’s address, and you should be directed to the new site.

 

———
MACINTOSH / APPLE

USE THE TERMINAL

Open the Terminal
–Search for Terminal from Spotlight (launch spotlight by holding down the Command key and pressing the space bar)

In the Terminal window type the following command:
sudo nano /private/etc/hosts

You will be prompted to enter your logon password again.

The file now loads in the terminal window where you will need to use your arrow keys to navigate to the bottom of the text file and add the IP and hostname you want to add. Example:
72.18.129.196   anySiteHosting.com
72.18.129.196   www.anySiteHosting.com

When you are done editing the file, hold down the control key and press the X key to exit the editor.
Press the Y key to answer Yes to save the file (the actual message is ‘save modified buffer’, but it just means save file)
Press the enter or return key at the next prompt (File Name to Write)

At this point you are returned to the standard Terminal prompt.
From here you can close the window, or enter the following command to close the window: killall Terminal

 


USE THE FINDER

Open Finder

Select the Go To Folder… command (Shift + Cmd + G) from the Go menu
Enter
/private/etc
in the Go to the folder: text box

Find the Hosts file and copy it to the desktop
Open the copy on your desktop, and edit the entries you wish to change (see notes in previous section) and save the file
Copy the file back to the /private/etc folder
When prompted to authenticate, press the button to replace the file and enter your password.

 

=========
EXAMPLES
———

 

=========
APPLIES TO / KEY WORDS
———
Test URL
Test Web Site

 

=========
REF
———
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

http://www.31bit.com/technology/74/295-easier-method-of-editing-the-hosts-file-on-mac-os-x-without-using-terminal

 


http://www.anysitesupport.com/how-do-i-edit-my-local-hosts-file/
http://anySiteHosting.com