Host files

I’m setting up this new domain and I’m having to setup my own domains and since Media Temple don’t handle .co.uk’s, I couldn’t set them up when I purchased the server space. So while I was waiting for a dns change to be propagated from a UK registration service. I wanted to test that I had configured the server correctly for the new urls and discovered a remarkably useful ‘hosts’ file in both Windows and OSX that allows you to override your dns server and redirect urls to ip addresses. Remarkably useful and I don’t know why I wasn’t aware of them.

On Windows there’s a file called ‘hosts’ in 

c:\windows\system32\drivers\etc\hosts

You can edit the file using a text editor and add in your testing servers url and the ip address to direct the browser to. e.g.

127.0.0.1       mywebsite.com

OSX also has a ‘hosts’ file in /etc/hosts

Again you can edit the host file by using 

sudo vi /etc/hosts

and then add the required host definitions.

One Comment Add yours

Leave a Reply