I am always trying to learn some new thing, new trick, new way of doing things. I as watching a video on setting up your WordPress domain installation. Sure, I’ve been doing it for years, but being self-taught for the most part as many webmasters are, did I miss something that everyone else knows?
No, actually not. It was interesting to see his choice of WordPress plugins, but nothing particularly enlightening. Though it IS nice to get some positive affirmation that I’m NOT an idiot and AM doing things the right way. WooHOO! However, what I DID notice was that this webmaster showed repointing his domain with the new nameservers with the statement, “Okay, you now need to wait for DNS propagation which can take anywhere from a few minutes to 24 hours or so to continue setting up your site.”
No. No, you don’t. So for all those people (particularly newbies) that are asking questions along the lines of, “Can I setup my WordPress before propogation or DNS server kicks in?” or “How can I setup my WordPress installation faster?” et al…
The answers are “YES” and “with a HOSTS file modification.”
How DNS Propagation works in a nutshell
In a big picture view, what you do when you setup a new nameserver for your new domain is to tell the internet that in order to find YOUR domain information, you need to go to this IP address (your new nameserver). The beauty of the internet and TCP/IP and all that is that there is distributed service – meaning simply that the whole ball of wax does NOT rely on any single server for anything. There are layers and layers of things to keep the internet running. In this case, your little domain name server will tell a server above it in hierarchy that it is handling requests for all xyz domain information. This in turn is passed up to the root domain servers eventually and then cascades back down to lower level servers.
If you haven’t made a request for that domain information, then most of these sub-servers will end up going to look up that info and be able to get the new data almost immediately. However, if you have requested that information in the near past, then an IP will already be associated with your domain in your existing chain of DNS servers. THAT’S when the DNS propagation may take a while. Each of these requests have a Time To Live or TTL time. These can range from an hour to days. and you will normally end up waiting for that TTL to expire before your servers will go look up that IP again.
So how DO you speed the whole processup?
Modify your HOSTS file. If you’re on a Windows machine – and I’m sure that the MacOS has something similar – your local machine has a file that it will reference to see where to find things – such as your new domain. So it’s just a matter of YOU telling your machine where to look.
First make sure that your system files are showing properly. Uncheck the “Hide protected operating system files” entry under your Folder Options from the Control Panel (or elsewhere) and then OK on out.
Open your HOSTS file
You will find this file at
C:WindowsSystem32driversetchosts and you will need to do this as an Administrator. If, after editing this file and trying to save it, you get a “Read only” or “Must be an administrator” type message, you will need to open up your notepad (I prefer UltraEdit) as an admin which will give you the privileges to edit and save that file.
Edit the HOSTS entries
Add in the IP address as listed on your new site setup. In this case I have 18.104.22.168 for the domain, funkydomain.com. The spaces can either be real spaces or a tab. It makes no difference. And I added another one for sample. This file CAN be large. I usually just comment out the domains in my HOSTS file when I no longer need them. That DOES boost the lookup time for domains, but it’s so small a time increase that I just toss the hash tag in there and then if I ever need it again, I can just remove the hash tag.
Save your HOSTS file and you should now be able to ping, OR go directly to your new site in a web browser. What this allows you to do is to setup your WordPress domain in all circumstances as soon as you have created a web hosting account for it. No waiting for propagation. No interruption of the process. Just straight through – boom, it’s done – goodness.
Another good command to know is the
ipconfig /flushdns done at a command prompt to force your PC DNS cache to delete everything and force a new lookup. If you HAVE requested the domain info and it’s still pointing to the old location, and THEN you add in the HOSTS file entry, sometimes you have to force that DNS cache to unload to get the new IP from the HOSTS file. Use the flushdns thing to accomplish that.
Questions? Ping me here.