Contents
[ hide ]
Summary
A hosts file is a plain-text file used by your Mac or Windows computer to map hostnames to IP addresses.
This article shows you how to edit your .hosts file in Mac OS X and Windows.
Modifying your computers hosts file is a useful if you wish to preview your website on Ecenica Hosting without modifying your domain name. Editing your hosts file can also be useful after registering a new domain name, recent domain transfer or DNS update. See How long does it take for my domain name to become active?
How does it work?
When you view a website your computer looks at it’s .hosts file to try and map the site host-name to an IP address. If a match is not found, your computer tries to find an IP address using the Domain Name System (DNS).
Editing your .hosts file let’s you intercept the DNS lookup and redirect your domain to another IP address.
The computer at the receiving IP address needs to answer to your domain name.
Why update my .hosts file?
- Easy migration. You can publish and test your site on your Ecenica Hosting web space without taking your old site offline.
- Faster web development. You can develop and test your site on your local server using your domain name.
- Redirect your domain to a local IP address.
- Simple and easy to use.
How do I change my .hosts file?
To view your website before updating your domain’s name servers or DNS records you will need to change your HOSTS file to point to your Ecenica Hosting IP address (Computer).
Apple OS X Lion, Snow Leopard & Leopard
- Open Terminal (Click Spotlight, or press Command+Space. Now type terminal.)
- Copy and paste the following code into Terminal
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts - Press Enter.
- Insert your Ecenica Hosting web site’s IP and domain name. See example below.
- Save by pressing Command+S, click Save.
- Restart your browser before attempting to view your site.
Example showing adding 100.100.100.100 example.com to hosts on Snow Leopard.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
##My Ecenica Hosting Websites
100.100.100.100 example.com
Apple OSX 10.4.X Tiger
- Open Terminal (Click Spotlight, or press Command+Space. Now type terminal.)
- In Terminal type, ‘sudo pico /etc/hosts‘, press Enter.
- Insert your Ecenica Hosting web site’s IP and domain name. For example: 100.100.100.100 example.com.
- Press Ctrl+X, then Y to save.
- Type ’sudo niload -v -m hosts . < /etc/hosts', press Enter
- Type ‘lookupd -flushcache’, press Enter.
Microsoft Windows 7
- Click Start -> All Programs -> Accessories.
- Right click “Notepad” and select “Run as administrator”
- Click Yes on the UAC prompt.
- Click File -> Open.
- Change the file filter drop down box from “Text Documents (*.txt)” to “All Files (*.*)”.
- Browse to “C:\Windows\System32\Drivers\etc”.
- Select “hosts” and click “Open”.
- Insert your Ecenica Hosting web servers IP and domain name. For example: 100.100.100.100 example.com.
- Close Notepad. Click Save when prompted.
Microsoft Windows Vista
- Click Start -> All Programs -> Accessories.
- Right click “Notepad” and select “Run as administrator”
- Click Continue on the UAC prompt.
- Click File -> Open.
- Change the file filter drop down box from “Text Documents (*.txt)” to “All Files (*.*)”.
- Browse to “C:\Windows\System32\Drivers\etc”.
- Select “hosts” and click “Open”.
- Insert your Ecenica Hosting web servers IP and domain name. For example: 100.100.100.100 example.com.
- Close Notepad. Click Save when prompted.
Microsoft XP/2003/2000
- Browse to Start > Programs > Accessories > Notepad.
- Click File > Open.
- Browse to “C:\Windows\System32\Drivers\etc”.
- Select “All Files (*.*)” from the Files of Type drop-down menu.
- Select “hosts” and click “Open”.
- Insert your Ecenica Hosting web servers IP and domain name. For example: 100.100.100.100 example.com.
- Close Notepad. Save when prompted.
This page is wiki editable click here to edit this page.
Sponsors
Web Hosting – £2.99/mo
Reliable UK web hosting. Free tech support. Trusted UK host since 2004. Free setup. Order online.
http://ecenica.com/
cPanel Hosting – £4.99/mo
Fast cPanel hosting with email. Choice of UK/US servers. 30-day money-back promise. Founded 2004.
http://ecenica.com/
Related posts:
- Edit Hosts File on Mac
- How To Flush DNS
- How to setup POP3 in Windows Mail
- Change email password in Windows WebsitePanel
- How to setup IMAP in Windows Mobile
Tags: apple, dns, domain, edit, hosts, how-to, leopard, lion, mac, nameserver, nameservers, osx, setup, snow leopard, vista, webspace, windows, windows 7, xp
