Edit Windows `hosts` File to Preview Content

Need to preview your site on a new server before DNS propagates? Here is the best method (assuming you are running Microsoft Windows): 

In some versions of Windows XP or below, go to Start -> Programs -> Accessories and click "notepad" or in Windows 7, Vista, right click notepad and "Run As Administrator") 

In notepad, go to file -> open and put in filename: c:\windows\system32\drivers\etc\hosts 

Add the following lines to the BOTTOM of that file: 

############################# 
xxx.xxx.xxx.xxx yourdomain.com 
xxx.xxx.xxx.xxx www.yourdomain.com 
############################### 

(replace xxx.xxx.xxx.xxx with the IP address of the new server and "yourdomain.com" with the actual domain name you want to preview) 

Save the file - keep the window open 

In some versions of Windows XP or below, go to Start -> Programs -> Accessories and click "Command Prompt" or in Windows 7, Vista, right click Command Prompt and "Run As Administrator") 

Type: 

ipconfig /flushdns 

Once you are done with that try pinging any of the domains. They should respond from the new IP: 

================= 
ping www.yourdomain.com 

Reply from xxx.xxx.xxx.xxx 
================= 

If you see that, your computer has been fooled into seeing the domains on the new server, while the rest of the world sees the old server. You should then exit all open browers, clear cookies/cache, and then re-open your webbrowser and test the domains. Please report any problems to us. 

Once you are done testing, to return to normal, go back into the window with the "hosts" file and remove all of the lines with the IP addresses and hostnames that you added (but leave 127.0.0.1). Run the ipconfig /flushdns command again and re-ping the sites to make sure you see the old IP. That way, when you transfer DNS and change the A records on the old server, you can accurately tell when it has propagated. 

Was this answer helpful?

 Print this Article

Also Read

Setting up a LAMP Stack

So you’ve got a provisioned VPS and you’re ready to start hosting a website! We’re not going to...

Authentication Failed - Email password is not working in desktop application

I tried accessing the email account from one of the email client on my desktop. It was generating...

How do I reset my cPanel password?

You are able to easily reset your cPanel password via our billing and support control panel.Below...

I did not receive my welcome email, but my service is listed as active

Sometimes, due to the high volume of mail we will send you in a short period of time some spam...

My service is marked as pending

SHARED/RESELLER/VPS: All DataCenter Hosting orders are reviewed manually by hand to ensure that...

Powered by WHMCompleteSolution