Tips & Tricks

Friday, January 25th, 2008 at 12:42 am
By Marco Sebastian

I’m a web developer, and sometimes I need to do things that require a lot of research to find. Recently, I stumbled on simple post that solved an issue I was trying to solve for days.

sudo nano /etc/hosts

What does that do?

When you launch the terminal and input that line, and your admin password, you will get and editor which houses the hosts file. Below the line “::1 localhost” you input an IP address following a website address.

Something like this:

##
# 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
::1 localhost
44.55.66.765 www.mymacproduct.com

This is very cool in many ways. I use it for masking websites to call a different server when loading a particular domain. What this enables me to do is keep the original site running on its original server. While I install and create the new site on a new server. Technically, no one can see it, unless they know the IP and which site is being edited.

How is this useful? Why don’t you just use the IP and work on the site that way you might ask?

Well, when installing scripts, it requires me to input directories, addresses, the URL of the website, etc. This can be a huge hassle if creating a large site, because it will require editing all the scripts to make sure they are linking to everything correctly. However, masking a site like I explained, any changes to the scripts can be done as if I was working on the live site. Once the site is ready, all I do is switch the DNS Server name from whatever domain company its located in.

Filed under Tips & Tricks. You can follow any responses to this article through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply


MacCritic.com © 2010. All Rights Reserved. Site Designed by Marco Sebastian. Chief Editor Marco Sebastian Lopez. News powered by WordPress. Trademarks and multimedia shown or mentioned in MacCritic.com are property of their respective owners. MacCritic.com is Valid XHTML 1.0 Strict.