This is one of those life-changing, super-awesome tips that I wish I had known about years ago. Note that this only works on Windows, and I’ve only tested it on Windows 7.

Here’s the scenario: you’ve got a client who has a website up and running on their domain name, You are creating a new WordPress site for them, but their old site needs to stay up until the very last minute. It would be great to be able to get their whole WordPress site installed and ready to go on a live server (i.e. not your localhost on your computer), and switch the domain’s DNS and voila – the new site replaces the old site almost immediately.

But you can’t really install and work with WordPress on a server that doesn’t have a domain name pointed at it. So here’s how you can fake this by making your computer think that the new site installation should be displayed as

  1. Install WordPress on the new server via Fantastico, Quick Install, or something like that.
  2. Open Notepad as administrator by right clicking on it and selecting “run as administrator”
  3. In Notepad, go to File >Open and find the following file in Windows: ?C:\Windows\System32\drivers\etc\hosts. If you see an empty “etc” folder, select All Files (see the screenshot below)
  4. Add the following line to the end of the hosts file:
    Where 123.45.678.90 is the IP address of the new server, and is the domain name that powers the existing site.  Change the IP address and to the new IP and new website URL.
    Here’s a screenshot of how it should look:
  5. Windows hosts file for IP redirection
  6. Save the file. Now visit in your browser, and you’ll see your new WordPress installation.

Hat tip to Mark Kaplun for this amazing trick.