{"id":24329,"date":"2022-02-02T14:30:23","date_gmt":"2022-02-02T14:30:23","guid":{"rendered":"https:\/\/1-grid.com\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/"},"modified":"2023-10-19T13:00:00","modified_gmt":"2023-10-19T13:00:00","slug":"plesk-how-to-access-a-website-using-a-local-hosts-file","status":"publish","type":"ht_kb","link":"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/","title":{"rendered":"Plesk:  How to access a website using a local hosts file?"},"content":{"rendered":"<blockquote><p><span style=\"font-family: Helvetica,sans-serif;\">This article provides you with information on how to access your website should via localhost.<\/span><\/p><\/blockquote>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<div>\n<div>\n<p><span style=\"font-family: Helvetica,sans-serif;\">Modifying the &#8216;hosts&#8217; file allows overriding DNS for a domain on a particular machine and causes local machine to look directly at the IP address specified.<\/span><\/p>\n<p><span style=\"font-family: Helvetica,sans-serif;\">For example, the domain example.com is hosted on a server with IP address 203.0.113.2, but is not resolved to this IP from the Internet. To make your PC\/Mac resolve this website to this particular IP address, just add the line below to your local &#8216;hosts&#8217; file like this:<\/span><\/p>\n<pre><span style=\"font-family: Helvetica,sans-serif;\">203.0.113.2 example.com www.example.com<\/span><\/pre>\n<h4><span style=\"font-family: Helvetica,sans-serif;\">Modifying the &#8216;hosts&#8217; file&#8230;<\/span><\/h4>\n<p><span style=\"font-family: Helvetica, sans-serif; font-size: 18px;\"><strong>on Windows OS<\/strong><\/span><\/p>\n<ul>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Start a command prompt as an Administrator.<\/span><\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Run the following command to open the &#8216;hosts&#8217; file in Windows Notepad:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-family: Helvetica,sans-serif;\">C:&gt; notepad C:WindowsSystem32Driversetchosts<\/span><\/pre>\n<ul>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Add domain&#8217;s IP address and a domain name on a new line.<\/span><\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Click File &gt; Save to save your changes.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><span style=\"font-family: Helvetica, sans-serif; font-size: 18px;\"><strong><br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: Helvetica, sans-serif; font-size: 18px;\"><strong>on macOS<\/strong><\/span><\/p>\n<ul>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Open\u00a0Applications &gt;\u00a0Utilities &gt;\u00a0Terminal.<\/span><\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Open the\u00a0hosts file by typing the following line in a terminal window:<\/span>\n<pre><span style=\"font-family: Helvetica,sans-serif;\"># sudo nano \/private\/etc\/hosts<\/span><\/pre>\n<p><span style=\"font-family: Helvetica,sans-serif;\">Type your domain user password when prompted<\/span><\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Add domain&#8217;s IP address and a domain name on a new line.<\/span><br \/>\n<span style=\"font-family: Helvetica,sans-serif;\">Note: The file contains some comments (lines starting with a hash &#8220;#&#8221; symbol) and some default hostname mappings (for example, 127.0.0.1 \u2013 local host). Add your new mappings after the default mappings.<\/span><\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Save the hosts file by pressing &#8216;Control+x&#8217;\u00a0and answering\u00a0y.<\/span><\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Make changes take effect by flushing the DNS cache with the following command:<\/span>\n<pre><span style=\"font-family: Helvetica,sans-serif;\"># dscacheutil -flushcache<\/span><\/pre>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Helvetica, sans-serif; font-size: 18px;\"><strong>on Linux OS<\/strong><\/span><\/p>\n<ul style=\"box-sizing: border-box; margin: 3px 0px 3px 1px; padding-left: 20px; list-style-position: outside;\">\n<li><span style=\"font-family: Helvetica,sans-serif;\">In Linux terminal, open the &#8216;hosts&#8217; file in a text editor:<\/span>\n<pre><span style=\"font-family: Helvetica,sans-serif;\"># vi \/etc\/hosts<\/span><\/pre>\n<\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Add domain&#8217;s IP address and a domain name on a new line.<\/span><\/li>\n<li><span style=\"font-family: Helvetica,sans-serif;\">Save the changes and close the file.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article provides you with information on how to access your website should via localhost. \u00a0 Modifying the &#8216;hosts&#8217; file allows overriding DNS for a domain on a particular machine and causes local machine to look directly at the IP address specified. For example, the domain example.com is hosted on&#8230;<\/p>\n","protected":false},"author":21,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"ht-kb-category":[24],"ht-kb-tag":[55,470,480,579,747,1086,1112],"class_list":["post-24329","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-website","ht_kb_tag-access","ht_kb_tag-hosting","ht_kb_tag-how-to","ht_kb_tag-local-host-file","ht_kb_tag-plesk","ht_kb_tag-using","ht_kb_tag-website"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Plesk: How To Access A Website Using A Local Hosts File?<\/title>\n<meta name=\"description\" content=\"Need to access a website using a local hosts file in Plesk? Follow our guide in the 1-grid Knowledge Base for an easy solution.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Plesk: How To Access A Website Using A Local Hosts File?\" \/>\n<meta property=\"og:description\" content=\"Need to access a website using a local hosts file in Plesk? Follow our guide in the 1-grid Knowledge Base for an easy solution.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/\" \/>\n<meta property=\"og:site_name\" content=\"1-grid Knowledge Base\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/1grid.co.za\/\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-19T13:00:00+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@1grid_hosting\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/\",\"name\":\"Plesk: How To Access A Website Using A Local Hosts File?\",\"isPartOf\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#website\"},\"datePublished\":\"2022-02-02T14:30:23+00:00\",\"dateModified\":\"2023-10-19T13:00:00+00:00\",\"description\":\"Need to access a website using a local hosts file in Plesk? Follow our guide in the 1-grid Knowledge Base for an easy solution.\",\"breadcrumb\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/1grid.co.za\/knowledge\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Plesk: How to access a website using a local hosts file?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#website\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/\",\"name\":\"1-Grid Domain Hosting Knowledge Base\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/1grid.co.za\/knowledge\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#organization\",\"name\":\"1-Grid Domain Hosting Knowledge Base\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg\",\"contentUrl\":\"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg\",\"width\":100,\"height\":100,\"caption\":\"1-Grid Domain Hosting Knowledge Base\"},\"image\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/1grid.co.za\/\",\"https:\/\/twitter.com\/1grid_hosting\",\"https:\/\/www.instagram.com\/1grid_hosting\/\",\"https:\/\/za.linkedin.com\/company\/1-grid\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Plesk: How To Access A Website Using A Local Hosts File?","description":"Need to access a website using a local hosts file in Plesk? Follow our guide in the 1-grid Knowledge Base for an easy solution.","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:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/","og_locale":"en_US","og_type":"article","og_title":"Plesk: How To Access A Website Using A Local Hosts File?","og_description":"Need to access a website using a local hosts file in Plesk? Follow our guide in the 1-grid Knowledge Base for an easy solution.","og_url":"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/","og_site_name":"1-grid Knowledge Base","article_publisher":"https:\/\/www.facebook.com\/1grid.co.za\/","article_modified_time":"2023-10-19T13:00:00+00:00","twitter_card":"summary_large_image","twitter_site":"@1grid_hosting","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/","url":"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/","name":"Plesk: How To Access A Website Using A Local Hosts File?","isPartOf":{"@id":"https:\/\/1grid.co.za\/knowledge\/#website"},"datePublished":"2022-02-02T14:30:23+00:00","dateModified":"2023-10-19T13:00:00+00:00","description":"Need to access a website using a local hosts file in Plesk? Follow our guide in the 1-grid Knowledge Base for an easy solution.","breadcrumb":{"@id":"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/1grid.co.za\/knowledge\/plesk-how-to-access-a-website-using-a-local-hosts-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/1grid.co.za\/knowledge\/"},{"@type":"ListItem","position":2,"name":"Plesk: How to access a website using a local hosts file?"}]},{"@type":"WebSite","@id":"https:\/\/1grid.co.za\/knowledge\/#website","url":"https:\/\/1grid.co.za\/knowledge\/","name":"1-Grid Domain Hosting Knowledge Base","description":"","publisher":{"@id":"https:\/\/1grid.co.za\/knowledge\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/1grid.co.za\/knowledge\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/1grid.co.za\/knowledge\/#organization","name":"1-Grid Domain Hosting Knowledge Base","url":"https:\/\/1grid.co.za\/knowledge\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/","url":"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg","contentUrl":"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg","width":100,"height":100,"caption":"1-Grid Domain Hosting Knowledge Base"},"image":{"@id":"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/1grid.co.za\/","https:\/\/twitter.com\/1grid_hosting","https:\/\/www.instagram.com\/1grid_hosting\/","https:\/\/za.linkedin.com\/company\/1-grid"]}]}},"_links":{"self":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/comments?post=24329"}],"version-history":[{"count":2,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24329\/revisions"}],"predecessor-version":[{"id":31383,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24329\/revisions\/31383"}],"wp:attachment":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/media?parent=24329"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb-category?post=24329"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb-tag?post=24329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}