{"id":213,"date":"2020-02-12T10:36:59","date_gmt":"2020-02-12T10:36:59","guid":{"rendered":"https:\/\/www.lcn.com\/support\/knowledge-base\/how-to-edit-your-hosts-file\/"},"modified":"2020-08-26T13:11:29","modified_gmt":"2020-08-26T13:11:29","slug":"how-to-edit-your-hosts-file","status":"publish","type":"ht_kb","link":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/","title":{"rendered":"How to edit your hosts file"},"content":{"rendered":"\n<p>First up, what is a hosts file? Well, put simply it\u2019s your computer\u2019s address book. This is used to map hostnames to IP addresses. Think of it a bit like the old telephone directories you\u2019d use to search a name to get the phone number.&nbsp;<\/p>\n\n\n\n<p>Whenever you put a website address in your web browser, your computer will check its hosts file for the IP to resolve the address to, before attempting to resolve the domain using the DNS servers on your network.&nbsp;<\/p>\n\n\n\n<p>So, why would you change it? Well, one of the main reasons for doing this, is to test whether a website works after you\u2019ve moved it to a new hosting provider, before changing the DNS to point to them. Changing your computer\u2019s hosts file&nbsp;tricks&nbsp;it into looking at the new server, rather than the old one and any changes in it happen instantly, compared to the 72 hours you may have to wait if you change the DNS on the domain.&nbsp;<\/p>\n\n\n\n<p>Ok, how do I do it?&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Editing the hosts file on a Windows PC&nbsp;<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>Click\u202f<strong>Start &gt; All Programs &gt; Accessories<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Right click\u202f<strong>Notepad<\/strong>\u202fand select\u202f<strong>Run as administrator<\/strong>\u00a0<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"380\" height=\"635\" src=\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png\" alt=\"\" class=\"wp-image-1292\" srcset=\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png 380w, https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad-180x300.png 180w, https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad-30x50.png 30w\" sizes=\"auto, (max-width: 380px) 100vw, 380px\" \/><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\"><li>Click\u202f<strong>Yes\/Continue<\/strong>\u202fon the user access prompt&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\"><li>Click\u202f<strong>File &gt; Open<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\"><li>Change the file filter drop down box from\u202f<strong>Text Documents (*.txt)\u201d to \u201cAll Files (<\/strong><strong>*.*<\/strong><strong>)<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"6\"><li>Go to\u202f<strong>C:\\Windows\\System32\\Drivers\\etc<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"7\"><li>Select\u202f<strong>hosts<\/strong>\u202fand click\u202f<strong>Open<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"8\"><li>Add the following 2 lines:&nbsp;<\/li><\/ol>\n\n\n\n<p><strong>123.123.123.123 mydomain.com<\/strong>&nbsp;<br><strong>123.123.123.123 www.mydomain.com<\/strong>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"947\" height=\"708\" src=\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/hosts_file.png\" alt=\"\" class=\"wp-image-1293\" srcset=\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/hosts_file.png 947w, https:\/\/www.lcn.com\/support\/wp-content\/uploads\/hosts_file-300x224.png 300w, https:\/\/www.lcn.com\/support\/wp-content\/uploads\/hosts_file-768x574.png 768w, https:\/\/www.lcn.com\/support\/wp-content\/uploads\/hosts_file-50x37.png 50w\" sizes=\"auto, (max-width: 947px) 100vw, 947px\" \/><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"9\"><li>Replace \u2018mydomain.com\u2019 with your domain name&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"10\"><li>Replace \u2018123.123.123.123\u2019 with the IP address of your LCN hosting. If you are not sure of the correct IP please \u202f<a href=\"https:\/\/www.lcn.com\/info\/contact\" target=\"_blank\" rel=\"noreferrer noopener\">contact us<\/a>.<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"11\"><li>Close Notepad. Click\u202f<strong>Save<\/strong>\u202fwhen prompted&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"12\"><li>Open your web browser and browser to the domain name above and it\u2019ll resolve to the IP you\u2019ve entered.&nbsp;<\/li><\/ol>\n\n\n\n<p>That\u2019s it! You\u2019ve successfully edited your hosts file.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Undoing the change\u00a0<\/h4>\n\n\n\n<p>When you have completed your checks you will want to undo the change you have made to avoid encountering problems in the future.<\/p>\n\n\n\n<p>To undo the\u00a0change,\u00a0you will simply need to repeat the above steps from 1 to\u00a07.\u00a0Rather than add lines you now remove the lines you added\u00a0before. Then close and\u00a0resave the file.\u00a0<\/p>\n\n\n\n<p>That\u2019s it&nbsp;your&nbsp;have&nbsp;successfully&nbsp;reverted the change to your hosts file.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Editing on a Mac\u00a0<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>Open\u202f<strong>Terminal<\/strong>\u202f(Click Spotlight, or press\u202f<strong>Command+Space<\/strong>. Now type\u202f<strong>terminal<\/strong>.)&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Copy and paste the following line into Terminal:\u202f<strong>sudo<\/strong><strong>&nbsp;nano \/etc\/hosts<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\"><li>Press\u202f<strong>Enter<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\"><li>You will now be prompted for your computer\u2019s password. Enter it and press\u202f<strong>Enter<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\"><li>The nano application will open with the hosts file loaded&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"6\"><li>Add the following 2 lines:&nbsp;<\/li><\/ol>\n\n\n\n<p><strong>123.123.123.123 mydomain.com<\/strong>&nbsp;<br><strong>123.123.123.123 www.mydomain.com<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"7\"><li>Replace \u201cmydomain.com\u201d with your domain name&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"8\"><li>Replace \u2018123.123.123.123\u2019 with the IP address of your LCN hosting. If you are not sure of the correct IP please \u202f<a href=\"https:\/\/www.lcn.com\/info\/contact\" target=\"_blank\" rel=\"noreferrer noopener\">contact us<\/a>.<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"9\"><li>Save by pressing\u202f<strong>Control+o<\/strong>\u202fthen pressing enter on the filename prompt&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"10\"><li>Press\u202f<strong>Control-x<\/strong>\u202fto exit nano&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"11\"><li>To have your host file changes to take immediate effect paste the following line into Terminal and press enter:\u202f<strong>dscacheutil<\/strong><strong>&nbsp;&#8211;<\/strong><strong>flushcache<\/strong>&nbsp;<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"12\"><li>Open your web browser and browser to the domain name above and it\u2019ll resolve to the IP you\u2019ve entered&nbsp;<\/li><\/ol>\n\n\n\n<p>That\u2019s it! You\u2019ve successfully edited your hosts file.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Undoing the change\u00a0<\/h4>\n\n\n\n<p>When you have completed your checks you will want to undo the change you have made to avoid encountering problems in the future.<\/p>\n\n\n\n<p>To undo the\u00a0change\u00a0you will simply need to repeat the above steps from 1 to 5. Rather than add lines you now remove the lines you have added and resave the file.\u00a0<\/p>\n\n\n\n<p>That\u2019s it your have&nbsp;successfully&nbsp;reverted the change to your hosts file.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First up, what is a hosts file? Well, put simply it\u2019s your computer\u2019s address book. This is used to map hostnames to IP addresses. Think of it a bit like the old telephone directories you\u2019d use to search a name to get the phone number.&nbsp; Whenever you put a website address in your web browser, [&hellip;]<\/p>\n","protected":false},"author":3,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[4],"ht-kb-tag":[5],"class_list":["post-213","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-managing-web-hosting","ht_kb_tag-web-hosting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to edit your hosts file - LCN.com Support Guide<\/title>\n<meta name=\"description\" content=\"This simple guide will show you how to change your local hosts file and view a website from a specific IP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to edit your hosts file - LCN.com Support Guide\" \/>\n<meta property=\"og:description\" content=\"This simple guide will show you how to change your local hosts file and view a website from a specific IP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Customer Support Guides - LCN\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/lcndotcom\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-26T13:11:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@lcndotcom\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/\",\"url\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/\",\"name\":\"How to edit your hosts file - LCN.com Support Guide\",\"isPartOf\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png\",\"datePublished\":\"2020-02-12T10:36:59+00:00\",\"dateModified\":\"2020-08-26T13:11:29+00:00\",\"description\":\"This simple guide will show you how to change your local hosts file and view a website from a specific IP.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#primaryimage\",\"url\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png\",\"contentUrl\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png\",\"width\":380,\"height\":635},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.lcn.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to edit your hosts file\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.lcn.com\/support\/#website\",\"url\":\"https:\/\/www.lcn.com\/support\/\",\"name\":\"Customer Support Guides - LCN\",\"description\":\"- LCN\",\"publisher\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.lcn.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.lcn.com\/support\/#organization\",\"name\":\"LCN.com\",\"url\":\"https:\/\/www.lcn.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg\",\"contentUrl\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg\",\"width\":461,\"height\":461,\"caption\":\"LCN.com\"},\"image\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/lcndotcom\",\"https:\/\/x.com\/lcndotcom\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to edit your hosts file - LCN.com Support Guide","description":"This simple guide will show you how to change your local hosts file and view a website from a specific IP.","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:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/","og_locale":"en_US","og_type":"article","og_title":"How to edit your hosts file - LCN.com Support Guide","og_description":"This simple guide will show you how to change your local hosts file and view a website from a specific IP.","og_url":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/","og_site_name":"Customer Support Guides - LCN","article_publisher":"https:\/\/www.facebook.com\/lcndotcom","article_modified_time":"2020-08-26T13:11:29+00:00","og_image":[{"url":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@lcndotcom","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/","url":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/","name":"How to edit your hosts file - LCN.com Support Guide","isPartOf":{"@id":"https:\/\/www.lcn.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#primaryimage"},"image":{"@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png","datePublished":"2020-02-12T10:36:59+00:00","dateModified":"2020-08-26T13:11:29+00:00","description":"This simple guide will show you how to change your local hosts file and view a website from a specific IP.","breadcrumb":{"@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#primaryimage","url":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png","contentUrl":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/Notepad.png","width":380,"height":635},{"@type":"BreadcrumbList","@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-edit-your-hosts-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lcn.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to edit your hosts file"}]},{"@type":"WebSite","@id":"https:\/\/www.lcn.com\/support\/#website","url":"https:\/\/www.lcn.com\/support\/","name":"Customer Support Guides - LCN","description":"- LCN","publisher":{"@id":"https:\/\/www.lcn.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lcn.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.lcn.com\/support\/#organization","name":"LCN.com","url":"https:\/\/www.lcn.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg","contentUrl":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg","width":461,"height":461,"caption":"LCN.com"},"image":{"@id":"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/lcndotcom","https:\/\/x.com\/lcndotcom"]}]}},"_links":{"self":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":3,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/213\/revisions"}],"predecessor-version":[{"id":1294,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/213\/revisions\/1294"}],"wp:attachment":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb-category?post=213"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb-tag?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}