{"id":2207,"date":"2021-06-25T10:57:55","date_gmt":"2021-06-25T07:57:55","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=2207"},"modified":"2022-05-11T16:56:18","modified_gmt":"2022-05-11T13:56:18","slug":"how-do-i-change-my-hosts-file","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-do-i-change-my-hosts-file\/","title":{"rendered":"How Do I Change My Hosts File?"},"content":{"rendered":"\n<p><span style=\"font-weight: 400;\">The hosts file is a system file that helps<\/span><b> map hostnames to their IP addresses<\/b><span style=\"font-weight: 400;\">. It lets people connect to websites with easy-to-remember domain names instead of their IP addresses. The file resolves domain names locally without querying <\/span><a href=\"https:\/\/www.scalahosting.com\/kb\/what-are-my-nameservers\/\"><b>DNS nameservers<\/b><\/a><span style=\"font-weight: 400;\">.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">It lets users<\/span><b> set IP addresses for domains on their computers for a faster name resolution<\/b><span style=\"font-weight: 400;\">. You can also block ads, malicious websites, and tracking sites in the hosts files to prevent your computer from connecting to them. The file also <\/span><b>lets users preview or test their website before pointing it to a new server.<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">You can edit entries in your host file in a couple of steps, and here\u2019s how.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Windows 8 and 10<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">You can find your system\u2019s hosts file on <\/span><b>Notepad<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n\n\n\n<p><b>If you use a Windows computer, take these steps to open the file and make your changes:<\/b><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-weight: 400;\">Find Notepad using the search bar, right-click the app, and select <\/span><b>Run as administrator<\/b><span style=\"font-weight: 400;\">.<\/span><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"343\" height=\"639\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/370.png\" alt=\"How Do I Change My Hosts File?, Windows 8 and 10\" class=\"wp-image-4077\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/370.png 343w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/370-161x300.png 161w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-weight: 400;\">Click <\/span><b>File<\/b><span style=\"font-weight: 400;\"> to launch the app, then choose <\/span><b>Open.<\/b><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-weight: 400;\">Go to <strong>c:\\Windows\\<\/strong><\/span><b>System32<\/b><span style=\"font-weight: 400;\"><b>\\<\/b><\/span><b>drivers\\etc<\/b><span style=\"font-weight: 400;\">.<\/span><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-weight: 400;\">Switch the file type from \u201c<\/span><b>Text Documents (*.txt<\/b><span style=\"font-weight: 400;\">) to \u201c<\/span><b>All Files<\/b><span style=\"font-weight: 400;\">\u201d and open the hosts file.<\/span><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"946\" height=\"533\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/371.png\" alt=\"How Do I Change My Hosts File?, Windows 8 and 10 2\" class=\"wp-image-4079\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/371.png 946w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/371-300x169.png 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/371-768x433.png 768w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-weight: 400;\">Make your changes in the host file, click <\/span><b>Files<\/b><span style=\"font-weight: 400;\"> > <\/span><b>Save<\/b><span style=\"font-weight: 400;\"> to apply the changes.<\/span><\/li><\/ul>\n\n\n\n<p><b>You can disable a line by prefacing it with the hashtag sign (#), for example:&nbsp;<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\"># <\/span><span style=\"font-weight: 400;\">216.58.223.228<\/span> <span style=\"font-weight: 400;\">google.com.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The hashtag makes the hosts file to ignore the line during name resolution, resolving the name via the domain name system (DNS). You could also block access to any domain by replacing its IP address with the<\/span><i><span style=\"font-weight: 400;\"> loopback IP addresses of 127.0.0.1 for IPv4 addressing or ::1 for IPv6 addressing.<\/span><\/i><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Linux<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">For Linux computers, follow these steps to change its hosts file.<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Use <\/span><b>CTRL + ALT + T<\/b><span style=\"font-weight: 400;\"> on your keyboard to open the Terminal<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Execute this command <\/span><b>sudo nano \/etc\/hosts <\/b><span style=\"font-weight: 400;\">&nbsp;at the command prompt to open the host file.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Enter your password if the system asks for it.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Make your desired changes and save using the <\/span><b>Control<\/b><span style=\"font-weight: 400;\"> and <\/span><b>X<\/b><span style=\"font-weight: 400;\"> key combination.<\/span><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Mac OS<\/b><\/h2>\n\n\n\n<p><b>Here\u2019s how to edit the hosts file on Mac computers:<\/b><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Log in to Mac with admin access<\/b><span style=\"font-weight: 400;\">\u2014you need administrator privileges to edit Mac\u2019s hosts file.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Open the Terminal<\/b><span style=\"font-weight: 400;\"> by selecting <\/span><b>Applications<\/b><span style=\"font-weight: 400;\"> &gt; <\/span><b>Utilities<\/b><span style=\"font-weight: 400;\"> &gt; <\/span><b>Terminal.<\/b><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Run this command<\/b> <span style=\"font-weight: 400;\">sudo nano \/<\/span><b>private<\/b><span style=\"font-weight: 400;\">\/etc\/hosts <\/span><span style=\"font-weight: 400;\">to open the hosts file.&nbsp;<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Edit your entries <\/b><span style=\"font-weight: 400;\">and save using the <\/span><b>Control<\/b><span style=\"font-weight: 400;\"> and <\/span><b>X key <\/b><span style=\"font-weight: 400;\">combination plus <\/span><b>Y<\/b><span style=\"font-weight: 400;\"> and <\/span><b>Enter<\/b><span style=\"font-weight: 400;\">.<\/span><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Need Help?<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">If you have <\/span><b>questions regarding editing your local hosts file<\/b><span style=\"font-weight: 400;\">, reach out to <\/span><a href=\"https:\/\/www.scalahosting.com\/contact-us.html\"><span style=\"font-weight: 400;\">our support<\/span><\/a><span style=\"font-weight: 400;\">. We\u2019re always available and ready to help.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The hosts file is a system file that helps map hostnames to their IP addresses. It lets people connect to websites with easy-to-remember domain names instead of their IP addresses. The file resolves domain names locally without querying DNS nameservers.&nbsp; It lets users set IP addresses for domains on their computers for a faster name [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[27],"tags":[],"class_list":["post-2207","post","type-post","status-publish","format-standard","hentry","category-vps-hosting"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=2207"}],"version-history":[{"count":8,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2207\/revisions"}],"predecessor-version":[{"id":4432,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2207\/revisions\/4432"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=2207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=2207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=2207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}