{"id":350,"date":"2014-02-27T17:35:21","date_gmt":"2014-02-27T22:35:21","guid":{"rendered":"http:\/\/underhost.com\/blog\/?p=350"},"modified":"2026-10-23T08:58:02","modified_gmt":"2026-10-23T12:58:02","slug":"bypass-dns-propagation-delay","status":"publish","type":"post","link":"https:\/\/underhost.com\/blog\/bypass-dns-propagation-delay\/","title":{"rendered":"Test a Website on a New Server Before DNS Changes (Hosts File Guide)"},"content":{"rendered":"<div class=\"uh-blog-hero\" style=\"margin:0 0 40px;text-align:center;padding:48px 24px;border-radius:20px;background:linear-gradient(135deg,#0D1F3C 0%,#125A8A 58%,#176EA5 100%);color:#ffffff;box-shadow:0 20px 40px -15px rgba(13,31,60,0.28);position:relative;overflow:hidden;\">\n<div style=\"display:inline-flex;align-items:center;gap:8px;padding:7px 14px;margin-bottom:16px;border:1px solid rgba(0,212,255,0.32);border-radius:999px;color:#DFF8FF;font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;background:rgba(0,212,255,0.10);\"><i class=\"fas fa-globe\" style=\"color:#00D4FF;\"><\/i> Domains &amp; DNS<\/div>\n<h1 style=\"color:#ffffff;font-size:clamp(32px,5vw,46px);line-height:1.12;margin:0 0 14px;font-weight:800;\">Test a Website on a New Server Before DNS Changes (Hosts File Guide)<\/h1>\n<p style=\"font-size:18px;color:#EAF6FF;max-width:800px;margin:0 auto;line-height:1.7;\">A simple tweak to your system\u2019s hosts file can allow immediate access to a website without waiting for DNS propagation.<\/p>\n<\/div>\n<div class=\"uh-blog-excerpt\" style=\"border-left:4px solid #00D4FF;padding:18px 20px;margin:0 0 34px;background:#F8FAFC;color:#1F2937;border-radius:0 14px 14px 0;box-shadow:0 8px 28px rgba(13,31,60,0.08);line-height:1.75;\"><strong style=\"color:#0D1F3C;\">Short answer:<\/strong> Add a line with the new server&#8217;s IP address and your domain to your computer&#8217;s hosts file, for example <code>203.0.113.10 example.com www.example.com<\/code>. Your computer then opens the site from the new server, while everyone else still sees the old one. The file is <code>C:\\Windows\\System32\\drivers\\etc\\hosts<\/code> on Windows and <code>\/etc\/hosts<\/code> on macOS and Linux. Flush your DNS cache, test the site, and remove the line once DNS has been updated.<\/div>\n<nav aria-label=\"Table of contents\" class=\"uh-toc\" style=\"background:#ffffff;border:1px solid #E5E7EB;border-radius:16px;padding:20px 22px;margin:0 0 34px;box-shadow:0 4px 12px rgba(13,31,60,0.08);\">\n<div style=\"font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:#176EA5;margin-bottom:10px;\"><i class=\"fas fa-list\" style=\"color:#00D4FF;\"><\/i> In this guide<\/div>\n<ol style=\"margin:0;padding-left:20px;columns:2 260px;column-gap:28px;line-height:1.9;\">\n<li><a href=\"#why-dns-changes-take-time\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Why DNS changes take time<\/a><\/li>\n<li><a href=\"#step-1-find-the-new-server-s-ip-address\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 1: find the new server&#8217;s IP address<\/a><\/li>\n<li><a href=\"#step-2-edit-the-hosts-file\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 2: edit the hosts file<\/a><\/li>\n<li><a href=\"#step-3-clear-the-dns-cache\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 3: clear the DNS cache<\/a><\/li>\n<li><a href=\"#step-4-confirm-you-are-on-the-new-server\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 4: confirm you are on the new server<\/a><\/li>\n<li><a href=\"#test-without-editing-any-file\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Test without editing any file<\/a><\/li>\n<li><a href=\"#what-to-check-on-the-new-server\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">What to check on the new server<\/a><\/li>\n<li><a href=\"#step-5-remove-the-hosts-entry\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 5: remove the hosts entry<\/a><\/li>\n<\/ol>\n<\/nav>\n<div class=\"uh-post-content\" style=\"color:#1F2937;font-size:16px;line-height:1.75;\">\n<h2 id=\"why-dns-changes-take-time\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-globe\" style=\"color:#00D4FF;\"><\/i> Why DNS changes take time<\/h2>\n<p style=\"margin:0 0 18px;\">When you change a DNS record, resolvers around the world keep the old answer until its TTL (time to live) runs out. This is often called propagation. With a typical TTL it takes from a few minutes to a day, and in some cases up to two days. The hosts file lets you skip that wait on your own computer, so you can check the new server before anyone else is sent to it.<\/p>\n<p style=\"margin:0 0 18px;\">The hosts file only changes what <strong>your<\/strong> computer sees. It does not speed up DNS for visitors.<\/p>\n<h2 id=\"step-1-find-the-new-server-s-ip-address\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 1: find the new server&#8217;s IP address<\/h2>\n<p style=\"margin:0 0 18px;\">The IP address is in your hosting welcome email, in cPanel under <strong>General Information<\/strong> (Shared IP Address or Dedicated IP Address), or in your server details. The examples below use <code>203.0.113.10<\/code>; replace it with your own.<\/p>\n<h2 id=\"step-2-edit-the-hosts-file\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 2: edit the hosts file<\/h2>\n<h3 style=\"color:#0D1F3C;font-size:21px;line-height:1.3;margin:26px 0 10px;\">Windows<\/h3>\n<ol style=\"margin:0 0 24px;padding-left:22px;\">\n<li style=\"margin:0 0 8px;\">Open the Start menu, type <strong>Notepad<\/strong>, right-click it and choose <strong>Run as administrator<\/strong>.<\/li>\n<li style=\"margin:0 0 8px;\">Choose <strong>File &gt; Open<\/strong> and open <code>C:\\Windows\\System32\\drivers\\etc\\hosts<\/code>. Set the file type to <strong>All Files<\/strong> so it appears.<\/li>\n<li style=\"margin:0 0 8px;\">Add the line at the end of the file and save.<\/li>\n<\/ol>\n<h3 style=\"color:#0D1F3C;font-size:21px;line-height:1.3;margin:26px 0 10px;\">macOS and Linux<\/h3>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>sudo nano \/etc\/hosts<\/code><\/pre>\n<p style=\"margin:0 0 18px;\">Add the line at the end, then press <strong>Ctrl+O<\/strong> and <strong>Enter<\/strong> to save, and <strong>Ctrl+X<\/strong> to exit.<\/p>\n<h3 style=\"color:#0D1F3C;font-size:21px;line-height:1.3;margin:26px 0 10px;\">The line to add<\/h3>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>203.0.113.10 example.com www.example.com<\/code><\/pre>\n<p style=\"margin:0 0 18px;\">Use only the domain names, without <code>http:\/\/<\/code>, <code>https:\/\/<\/code> or a path. Lines that start with <code>#<\/code> are comments.<\/p>\n<h2 id=\"step-3-clear-the-dns-cache\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-globe\" style=\"color:#00D4FF;\"><\/i> Step 3: clear the DNS cache<\/h2>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code># Windows (Command Prompt)\nipconfig \/flushdns\n\n# macOS\nsudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder\n\n# Linux with systemd-resolved\nsudo resolvectl flush-caches<\/code><\/pre>\n<p style=\"margin:0 0 18px;\">Close and reopen the browser, because browsers keep their own short DNS cache. If the old site still appears, try a private window. Browsers set to use secure DNS (DNS over HTTPS) may skip the hosts file, so turn that setting off while you test. Our guide to <a href=\"https:\/\/underhost.com\/blog\/how-to-flush-dns-and-clear-cache-on-windows-and-popular-browsers\/\">flushing DNS and browser caches<\/a> has more detail.<\/p>\n<h2 id=\"step-4-confirm-you-are-on-the-new-server\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 4: confirm you are on the new server<\/h2>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>ping example.com          # should show 203.0.113.10\nnslookup example.com      # shows public DNS, which ignores the hosts file<\/code><\/pre>\n<p style=\"margin:0 0 18px;\"><code>ping<\/code> uses the hosts file, so it should show the new IP address. <code>nslookup<\/code> asks a DNS server directly, so it still shows the old address until DNS changes. That difference is a quick way to confirm your hosts entry works. A small test file, for example a <code>test.txt<\/code> uploaded only to the new server, also tells you which server you reached.<\/p>\n<h2 id=\"test-without-editing-any-file\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-angle-double-right\" style=\"color:#00D4FF;\"><\/i> Test without editing any file<\/h2>\n<p style=\"margin:0 0 18px;\">If you are comfortable with the command line, <code>curl<\/code> can send a single request to the new server without changing your hosts file:<\/p>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>curl -I --resolve example.com:443:203.0.113.10 https:\/\/example.com\/\ncurl -I --resolve example.com:80:203.0.113.10 http:\/\/example.com\/<\/code><\/pre>\n<h2 id=\"what-to-check-on-the-new-server\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-clipboard-check\" style=\"color:#00D4FF;\"><\/i> What to check on the new server<\/h2>\n<ul style=\"list-style:none;padding-left:0;\">\n<li style=\"margin:0 0 8px;\">\u2713 The home page and key pages load, with images and styles.<\/li>\n<li style=\"margin:0 0 8px;\">\u2713 Logins, contact forms and checkout work.<\/li>\n<li style=\"margin:0 0 8px;\">\u2713 The site connects to its database without errors.<\/li>\n<li style=\"margin:0 0 8px;\">\u2713 Email settings, if the site sends mail.<\/li>\n<li style=\"margin:0 0 8px;\">\u2713 Scheduled tasks (cron jobs) are set up.<\/li>\n<\/ul>\n<p style=\"margin:0 0 18px;\">A certificate warning is normal at this stage if the new server cannot get a Let&#8217;s Encrypt certificate until DNS points to it. AutoSSL issues one shortly after the switch.<\/p>\n<h2 id=\"step-5-remove-the-hosts-entry\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 5: remove the hosts entry<\/h2>\n<p style=\"margin:0 0 18px;\">Once you change DNS and the new records are live, delete the line from the hosts file and flush the DNS cache again. A forgotten entry keeps your computer on that IP address, even after a later move, which is a common cause of &#8220;the site works for everyone but me&#8221;.<\/p>\n<p style=\"margin:0 0 18px;\">Planning a move? See our guide to <a href=\"https:\/\/underhost.com\/blog\/how-to-migrate-your-website-to-underhost-without-downtime\/\">moving a website without downtime<\/a>.<\/p>\n<div aria-hidden=\"true\" class=\"uh-section-divider\" style=\"width:min(100% - 32px, 1080px);margin:44px auto;display:grid;grid-template-columns:1fr 32px 1fr;align-items:center;gap:18px;pointer-events:none;\"><span style=\"height:1px;background:linear-gradient(90deg,transparent,rgba(0,212,255,0.40),rgba(23,110,165,0.24),transparent);\"><\/span><img alt=\"\" decoding=\"async\" height=\"32\" loading=\"lazy\" src=\"https:\/\/cdn.underhost.com\/android-chrome-192x192.webp\" style=\"width:32px;height:32px;display:block;border-radius:8px;filter:drop-shadow(0 0 14px rgba(0,212,255,0.30));\" width=\"32\"\/><span style=\"height:1px;background:linear-gradient(90deg,transparent,rgba(23,110,165,0.24),rgba(0,212,255,0.40),transparent);\"><\/span><\/div>\n<\/div>\n<div class=\"uh-blog-cta\" style=\"background:linear-gradient(135deg,#0D1F3C 0%,#125A8A 58%,#176EA5 100%);color:#ffffff;padding:36px 24px;border-radius:20px;text-align:center;margin:44px 0;box-shadow:0 20px 40px -15px rgba(13,31,60,0.32);\">\n<h2 style=\"margin:0 0 12px;font-size:28px;line-height:1.25;color:#ffffff;\">Need help with this?<\/h2>\n<p style=\"font-size:17px;margin:0 auto 22px;color:#EAF6FF;max-width:720px;line-height:1.7;\">Moving to UnderHost? Our team can help copy your site and plan the DNS switch.<\/p>\n<p><a href=\"https:\/\/underhost.com\/shared-hosting.php\" style=\"background:linear-gradient(90deg,#00D4FF,#0077FF);color:#ffffff;padding:13px 28px;border-radius:10px;text-decoration:none;font-weight:800;display:inline-block;margin:8px;\">See web hosting plans<\/a><a href=\"https:\/\/customerpanel.ca\/client\/\" style=\"background:transparent;color:#ffffff;padding:12px 28px;border-radius:10px;text-decoration:none;font-weight:800;display:inline-block;margin:8px;border:1px solid rgba(255,255,255,0.32);\">Contact @CustomerPanel<\/a><\/div>\n<div class=\"uh-faq-section\" id=\"faq\" style=\"margin:34px 0;scroll-margin-top:90px;\">\n<h2 style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:0 0 18px;border-bottom:2px solid rgba(0,212,255,0.22);padding-bottom:10px;\">Frequently asked questions<\/h2>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">Does editing the hosts file speed up DNS propagation?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">Only for your own computer. Visitors still see the old server until their DNS caches expire.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">Where is the hosts file on Windows?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">C:\\Windows\\System32\\drivers\\etc\\hosts. Open it with Notepad running as administrator.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">Why does my browser still show the old site?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">The browser or system DNS cache still has the old address, or the browser uses secure DNS. Flush the cache, restart the browser, or try a private window.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">Can I use the hosts file on a phone?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">Not easily. Test from a computer, or use curl with the &#8211;resolve option.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">How do I lower the wait before switching DNS?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">A day before the move, lower the TTL of your DNS records, for example to 300 seconds. The switch then reaches most visitors within minutes.<\/p>\n<\/div>\n<\/div>\n<p><!-- uh-related-start --><\/p>\n<div style=\"background:#F4F8FC;border:1px solid #DCE7F3;border-radius:14px;padding:18px 22px;margin:32px 0 8px;\">\n<h2 style=\"margin:0 0 12px;font-size:22px;\">Related guides<\/h2>\n<ul style=\"margin:0;padding-left:20px;\">\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/how-to-flush-dns-and-clear-cache-on-windows-and-popular-browsers\/\">How to Flush DNS and Clear Cache on Windows and Popular Browsers<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/how-to-use-whms-email-deliverability-interface-to-fix-mail-dns-issues\/\">How to Use WHM\u2019s Email Deliverability Interface to Fix Mail DNS Issues<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/whm-unable-create-remove-accounts\/\">Why Your Server Might Be Failing DNS Lookups &amp; How to Fix It<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/how-do-i-flush-a-computers-dns-cache\/\">How to Flush a Computer\u2019s DNS Cache<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/configure-exim-cpanel-server-use-smart-host\/\">Updated MARCH 2025: How to Configure a Smart Host in Exim<\/a><\/li>\n<\/ul>\n<\/div>\n<p><!-- uh-related-end --><br \/>\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Does editing the hosts file speed up DNS propagation?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Only for your own computer. Visitors still see the old server until their DNS caches expire.\"}}, {\"@type\": \"Question\", \"name\": \"Where is the hosts file on Windows?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"C:\\\\Windows\\\\System32\\\\drivers\\\\etc\\\\hosts. Open it with Notepad running as administrator.\"}}, {\"@type\": \"Question\", \"name\": \"Why does my browser still show the old site?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"The browser or system DNS cache still has the old address, or the browser uses secure DNS. Flush the cache, restart the browser, or try a private window.\"}}, {\"@type\": \"Question\", \"name\": \"Can I use the hosts file on a phone?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Not easily. Test from a computer, or use curl with the --resolve option.\"}}, {\"@type\": \"Question\", \"name\": \"How do I lower the wait before switching DNS?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"A day before the move, lower the TTL of your DNS records, for example to 300 seconds. The switch then reaches most visitors within minutes.\"}}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A simple tweak to your system\u2019s hosts file can allow immediate access to a website without waiting for DNS propagation.<\/p>\n","protected":false},"author":1,"featured_media":4676,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[122,115,124],"class_list":["post-350","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domains-dns","tag-tag-dns","tag-tag-linux-server","tag-tag-ssl"],"_links":{"self":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":8,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":6963,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/350\/revisions\/6963"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media\/4676"}],"wp:attachment":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}