How to install WordPress without a domain name
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, www.mysite.com. 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 www.mysite.com:
- Install WordPress on the new server via Fantastico, Quick Install, or something like that.
- Open Notepad as administrator by right clicking on it and selecting “run as administrator”
- 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)
- 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 mysite.com is the domain name that powers the existing site. Change the IP address and mysite.com to the new IP and new website URL.
Here’s a screenshot of how it should look:
- Save the file. Now visit mysite.com in your browser, and you’ll see your new WordPress installation.
Hat tip to Mark Kaplun for this amazing trick.