Host File Modification for Web Design

When moving a client’s site from one host to another,whether it be the same or an updated version,any consciencous webmaster should take a few considerations.

  1. His priority should be to minimize the website downtime between DNS changes
  2. Editing a live website might cause temporary problems to visitors or logged users

Luckily,there’s a neat way to accomplish a seamless web host transfer by making changes to a simple file on our computer.
Since the DNS are still pointing to the old host,typing site’s the address in a web browser will take you to the old website/host which is not what we want so we will trick our computer into taking us to the new host.Doing so wil enable us work directly from there and view the changes we apply as if the site was live.

The Host file

Historically,and before the Internet as we know was accessible to everyone,the host file was used to map networks for ARPANET (it’s predecessor) before the invention of Domain Name Servers (DNS) in 1983.The file,still used in modern operating systems,retained it’s function which is to map a name like intelligentwebdesigner.com to a numerical address(example; 64.2.53.12) and will override any DNS information sent to your computer.

Permission to Edit The File

The file is owned by the Administrator.

On Windows

On Windows open the Notepad using “Run as administrator”
Open the file from notepad,the locations are loosely different depending on the operating system;
Windows 95 – C:windows
Windows 98 – C:\windows
Windows Me – C:\windows
Windows 2000 – C:windows\system32\drivers\etc
Windows XP – C:\windows\system32\drivers\etc
Windows NT – C:\winnt\system32\drivers\etc
Windows Vista – C:\windows\system32\drivers\etc
Windows 7 – C:\windows\system32\drivers\etc

On Linux or Mac

On Mac or Linux, open a console and log as root,then run VIM,emacs or any text editor of your choice.

The file is located at;

/etc/hosts
So for example;

sudo vim /etc/hosts

Will launch VIM as super-user to edit the file.

Editing and Saving The Host File

Since the host file is a simple text file with a few lines,modifying it is also a simple task.
What you see inside is roughly the same in every operating system,something like;

127.0.0.1 localhost
::1 localhost

All you have to do is insert your domain name and the IP of the new Webhost right underneath this section.Usually I’ll add both version with www. and without it.
Example;

127.0.0.1 localhost
::1 localhost
64.2.211.12 intelligentwebdesigner.com
64.2.211.12 www.intelligentwebdesigner.com

Save the file and you’re done.Now typing the Domain name in a browser now take you to the new host.

Additional operating system information

Some operating systems might require a reboot after that and some Linux distribution might require you to confirm that the hosts file is actually used for the host lookup.

To do so go into;

/etc/host.conf

and confirm that the following line is included;

order hosts,bind

That’s it don’t forget to remove the entries when you’re done and the DNS switch has occured.

Top

Leave a Reply

Your email address will not be published. Required fields are marked *

Who am I

Hi my name is Stéphane,
I am a Digital Artist,Musician and Wordpress addict.I love creating compelling Wordpress themes that are visually tailored to my client's needs or previous HTML designs.Whether you want a Wordpress Blog to match your existing template or simply want a new custom Wordpress Theme just contact me I am meticulous and I love working with serious people with high requirements.

FaceBook

Copyright ©2011-2017 Intelligent Web Designer Wordpress Artist All rights reserved. Any redistribution or reproduction of part or all of the contents in any form is prohibited other than the following. 1)you may print or download to a local hard disk extracts for your personal and non-commercial use only, 2)you may copy the content to individual third parties for their personal use, but only if you acknowledge the website as the source of the material.You may not, except with our express written permission, distribute or commercially exploit the content. Nor may you transmit it or store it in any other website or other form of electronic retrieval system.

Privacy Policy XML-Sitemap