{"id":3395,"date":"2014-07-09T23:52:34","date_gmt":"2014-07-10T04:52:34","guid":{"rendered":"http:\/\/wpengine.wpengine.com\/?post_type=support&#038;p=3395"},"modified":"2026-01-14T05:54:24","modified_gmt":"2026-01-14T11:54:24","slug":"emulate-dns-change-with-the-hosts-file-trick","status":"publish","type":"support","link":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/","title":{"rendered":"Emulate DNS Locally with the Hosts File Trick"},"content":{"rendered":"<div style=\"color:#32373c;background-color:#00d1b2\" class=\"wp-block-genesis-blocks-gb-notice gb-font-size-18 gb-block-notice\" data-id=\"aa1459\"><div class=\"gb-notice-title\" style=\"color:#fff\"><p>NOTICE<\/p><\/div><div class=\"gb-notice-text\" style=\"border-color:#00d1b2\">\n<p>The hosts file trick works with the <a href=\"https:\/\/wpengine.com\/support\/network\/\">WP Engine legacy network<\/a> by default. The hosts file trick may work with the <a href=\"https:\/\/wpengine.com\/support\/advanced-network\/\">Advanced Network<\/a> or <a href=\"https:\/\/wpengine.com\/support\/ges\/\">Global Edge Security<\/a> networks if the domain has already been <a href=\"https:\/\/wpengine.com\/support\/add-domain-in-user-portal\/#Verify_Domain_Ownership\" target=\"_blank\" rel=\"noreferrer noopener\">pre-verified<\/a> by Cloudflare.<\/p>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\">\n\n\n\n<p>Did you know you can test your site on WP Engine after <a href=\"https:\/\/wpengine.com\/support\/wp-engine-site-migration\/\" target=\"_blank\" rel=\"noreferrer noopener\">migrating<\/a> <em>without<\/em> changing your DNS, just by editing a file on your computer?<\/p>\n\n\n\n<p>When you visit a website your computer saves the server IP address of the domain in the \u201chosts file\u201d. This speeds up the connection time the next time you request the website from that computer, because it already knows where to look.<\/p>\n\n\n\n<p>By modifying this file, you can trick your local computer into thinking that a domain lives at a <em>different<\/em> IP address than is actually configured with the DNS host. Best of all, the change is local to your machine only. Meaning no one sees the change but you, and it can be reverted just as easily once you\u2019re done testing.<\/p>\n\n\n\n\n\n<a name=\"ip\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h2 class=\"wp-block-heading\">Locate WP Engine IP<\/h2>\n\n\n\n<p>In order to point your domain to WP Engine on your local machine, you will need to know your WP Engine IP address. To find your IP address:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to the <a href=\"https:\/\/my.wpengine.com\/sites\/\">User Portal<\/a><\/li>\n\n\n\n<li>Select the <strong>environment<\/strong> <strong>name<\/strong><\/li>\n\n\n\n<li>Click <strong>Domains<\/strong><\/li>\n\n\n\n<li>Next to the domain, open the <strong>three dot menu icon<\/strong><\/li>\n\n\n\n<li>Click <strong>View DNS details<\/strong><\/li>\n<\/ol>\n\n\n\n<p>WP Engine provides two IP addresses. When testing with the hosts file either IP shown may be used.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2023\/05\/view-dns-details.png\" alt=\"\"><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h2 class=\"wp-block-heading\">Edit Hosts File<\/h2>\n\n\n\n<p>Edit the hosts file so that the domain name directly corresponds to the WP Engine IP on the same line. Add a new line to the local hosts section of the host file with the format of: <strong>ipaddress domain.com<\/strong><\/p>\n\n\n\n<p>For example: IP is <strong>123.456.78.90<\/strong> and the domain is <strong>mycooldomain.com<\/strong><\/p>\n\n\n\n<p>Therefore, add the following line to the hosts file:<\/p>\n\n\n\n<p><code>123.456.78.90 mycooldomain.com<\/code><\/p>\n\n\n\n<p>The steps to editing the hosts file will vary depending on whether you run a PC or a Mac, and also on the version of your operating system. Because of the variations and since there is already good documentation on how to edit the hosts file, we\u2019ve compiled a set of external resources, one of which will fit your particular operating system.<\/p>\n\n\n\n<p><a href=\"#windows\">Windows operating systems<\/a><br><a href=\"#mac\">Mac operating systems<\/a><\/p>\n\n\n\n<a name=\"windows\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h3 class=\"wp-block-heading\">Windows Documentation<\/h3>\n\n\n\n<p>Windows includes a utility called Hosts File Editor Utility, which makes it easy to manage custom host IPs in a user interface.<\/p>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/powertoys\/hosts-file-editor\">Learn more about using this utility on Microsoft\u2019s website.<\/a><\/p>\n\n\n\n<a name=\"mac\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h3 class=\"wp-block-heading\">Mac OS X Documentation<\/h3>\n\n\n\n<p>On a Mac, there are two helpful tools for editing your hosts file called <a href=\"https:\/\/en.toolinbox.net\/iHosts\/\" target=\"_blank\" rel=\"noreferrer noopener\">iHosts<\/a> and <a href=\"http:\/\/www.macupdate.com\/app\/mac\/29949\/gas-mask\">Gas Mask<\/a>. These applications help you easily manage multiple hosts file entries and edit without entering Terminal or using command line.<\/p>\n\n\n\n<a name=\"flushdns\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h2 class=\"wp-block-heading\">Flush DNS<\/h2>\n\n\n\n<p>Last, you will need to flush the DNS cache on your machine so it knows to read the new entries in your hosts file instead of the old, saved entries. On many devices restarting will clear this cache, however to ensure the changes are being observed, we recommend following the steps to manually flush your DNS cache.<\/p>\n\n\n\n<p>Steps to flush DNS will vary based on the Operating System of your computer. We have included videos of each below.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Windows 10<\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How To Flush DNS in Windows 10 ?\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/YQv2btIgTmE?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Windows 8<\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How To Flush DNS Cache on a Windows 8 Computer\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/iQ5FYdjdiHg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Mac OSX<\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to Clear DNS Cache Mac -  cmd flush dns on a Mac\" width=\"1160\" height=\"870\" src=\"https:\/\/www.youtube.com\/embed\/QDEGweRGX5Y?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<a name=\"relaunch\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h2 class=\"wp-block-heading\">Relaunch Browser<\/h2>\n\n\n\n<p>In order for the hosts file settings to take effect, please restart your web browser completely. You can now access your website hosted by WP Engine using the domain name as normal in your browser.<\/p>\n\n\n\n<p>To revert the changes, simply delete the line added to your host file, or comment it out. Then flush DNS and restart your browser.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<p><strong>NEXT STEP: <a href=\"https:\/\/wpengine.com\/support\/going-live\/\">Going live with a domain on WP Engine<\/a><\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>Learn how to view your site on WP Engine without pointing your DNS. Steps to update your hosts file, and steps to flush your DNS on Windows and Mac.<\/p>\n","protected":false},"featured_media":126216,"template":"","meta":{"_acf_changed":false,"mediapress_authors_byline":[],"mediapress_draft_name":"","_mediapress_is_draft_copy":false},"support-categories":[43,7],"support-tag":[42,19,22],"mediapress_author":[],"class_list":["post-3395","support","type-support","status-publish","has-post-thumbnail","hentry","support-categories-domain-names","support-categories-troubleshoot","support-tag-dns","support-tag-domain","support-tag-video"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Emulate DNS Locally with the Hosts File Trick | WP Engine<\/title>\n<meta name=\"description\" content=\"We provide steps to preview your website&#039;s website content and database on WP Engine prior to changing your DNS, by using a Hosts File Trick.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Emulate DNS Locally with the Hosts File Trick | WP Engine\" \/>\n<meta property=\"og:description\" content=\"We provide steps to preview your website&#039;s website content and database on WP Engine prior to changing your DNS, by using a Hosts File Trick.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/\" \/>\n<meta property=\"og:site_name\" content=\"Support Center\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-14T11:54:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/\",\"url\":\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/\",\"name\":\"Emulate DNS Locally with the Hosts File Trick | WP Engine\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"datePublished\":\"2014-07-10T04:52:34+00:00\",\"dateModified\":\"2026-01-14T11:54:24+00:00\",\"description\":\"We provide steps to preview your website's website content and database on WP Engine prior to changing your DNS, by using a Hosts File Trick.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#primaryimage\",\"url\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"contentUrl\":\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\",\"width\":1200,\"height\":630,\"caption\":\"WP Engine\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Support Posts\",\"item\":\"https:\/\/wpengine.com\/support\/support\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Emulate DNS Locally with the Hosts File Trick\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/support\/#website\",\"url\":\"https:\/\/wpengine.com\/support\/\",\"name\":\"Support Center\",\"description\":\"WP Engine&#039;s Support Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Emulate DNS Locally with the Hosts File Trick | WP Engine","description":"We provide steps to preview your website's website content and database on WP Engine prior to changing your DNS, by using a Hosts File Trick.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/","og_locale":"en_US","og_type":"article","og_title":"Emulate DNS Locally with the Hosts File Trick | WP Engine","og_description":"We provide steps to preview your website's website content and database on WP Engine prior to changing your DNS, by using a Hosts File Trick.","og_url":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/","og_site_name":"Support Center","article_modified_time":"2026-01-14T11:54:24+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/","url":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/","name":"Emulate DNS Locally with the Hosts File Trick | WP Engine","isPartOf":{"@id":"https:\/\/wpengine.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","datePublished":"2014-07-10T04:52:34+00:00","dateModified":"2026-01-14T11:54:24+00:00","description":"We provide steps to preview your website's website content and database on WP Engine prior to changing your DNS, by using a Hosts File Trick.","breadcrumb":{"@id":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#primaryimage","url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","contentUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","width":1200,"height":630,"caption":"WP Engine"},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/support\/emulate-dns-change-with-the-hosts-file-trick\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/support\/"},{"@type":"ListItem","position":2,"name":"Support Posts","item":"https:\/\/wpengine.com\/support\/support\/"},{"@type":"ListItem","position":3,"name":"Emulate DNS Locally with the Hosts File Trick"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/support\/#website","url":"https:\/\/wpengine.com\/support\/","name":"Support Center","description":"WP Engine&#039;s Support Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support\/3395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/types\/support"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media\/126216"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media?parent=3395"}],"wp:term":[{"taxonomy":"support-categories","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-categories?post=3395"},{"taxonomy":"support-tag","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-tag?post=3395"},{"taxonomy":"mediapress_author","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/mediapress_author?post=3395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}