{"id":214,"date":"2018-09-17T19:17:44","date_gmt":"2018-09-17T19:17:44","guid":{"rendered":"https:\/\/www.rochen.com\/docs\/?post_type=ht_kb&#038;p=214"},"modified":"2023-05-29T10:15:44","modified_gmt":"2023-05-29T10:15:44","slug":"modifying-your-hosts-file","status":"publish","type":"ht_kb","link":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/","title":{"rendered":"Modifying Your Hosts File"},"content":{"rendered":"<p>This guide will provide a method of viewing\/testing a domain on Rochen&#8217;s servers without actually changing that domain&#8217;s global DNS over to Rochen&#8217;s network on both Windows and Mac OSX. Typically, this type of functionality is gained through using Apache&#8217;s mod_userdir, but this is actually a highly ineffective approach for serious development and testing.<\/p>\n<p>The reason the above method is ineffective is due to the well-documented compatibility issues between Apache&#8217;s mod_userdir and mod_rewrite. Often, in order to properly test an application, the application&#8217;s URL will need to be changed to the mod_userdir temporary URL (http:\/\/subdomain.servername.com\/~USERNAME), which can cause unexpected and unnecessary complications.<\/p>\n<p>The preferred alternative is modify your local hosts file. By modifying your hosts file properly, you can point your domain to a specific IP address (i.e. the one assigned to your Rochen hosting account) without having to defer to your router\/network or on an external DNS resolver to inform your machine of the IP address of your domain. This means that if you make your modifications correctly, you can view your website in your browser, using your normal domain name, without actually affecting the global DNS of your domain whatsoever.<\/p>\n<h3>Windows<\/h3>\n<p>Firstly, to edit your hosts file on Windows, you will need to open a text editor (Notepad will suffice here) as an Administrator:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-215 size-full\" src=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad.png\" alt=\"\" width=\"471\" height=\"504\" srcset=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad.png 471w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad-280x300.png 280w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad-47x50.png 47w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad-56x60.png 56w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad-93x100.png 93w\" sizes=\"auto, (max-width: 471px) 100vw, 471px\" \/><\/p>\n<p>You must run Notepad as an Administrator or you will not have sufficient permission to modify the hosts file, which is write-protected for any user below Administrator by default. Once you have Notepad running under the Administrator account, open the following file:<\/p>\n<pre>C:\\Windows\\System32\\drivers\\etc\\hosts<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-216 size-full\" src=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin2.png\" alt=\"\" width=\"952\" height=\"559\" srcset=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin2.png 952w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin2-300x176.png 300w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin2-768x451.png 768w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin2-50x29.png 50w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin2-60x35.png 60w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin2-100x59.png 100w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/p>\n<p>Once your hosts file is open, you will see instructions for composing entries, along with a few examples.<\/p>\n<p>You will want to add your website&#8217;s IP address (contact Rochen support if you do not have this information) and your domain name at the bottom of the file, as shown in the following screenshot:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-217 size-full\" src=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin3.png\" alt=\"\" width=\"853\" height=\"680\" srcset=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin3.png 853w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin3-300x239.png 300w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin3-768x612.png 768w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin3-50x40.png 50w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin3-60x48.png 60w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150admin3-100x80.png 100w\" sizes=\"auto, (max-width: 853px) 100vw, 853px\" \/><\/p>\n<p>Save the file.<\/p>\n<p>Once saved, we will need to clear out your DNS resolver cache, as your computer will likely have the old IP cached for your site&#8217;s DNS and will not actually consult the hosts file in order to find it. To clear your DNS resolver cache, cPanel has a great guide located here.<\/p>\n<p>You may now access your domain from your Rochen server.<\/p>\n<h3>Mac OSX<\/h3>\n<p>The easiest way to make modifications to the host file on OSX is via the Terminal. To open your terminal, you will want to perform the following:<\/p>\n<p>1. Click the Spotlight icon in the top-right of your desktop (magnifying glass)<\/p>\n<p>2. Type: terminal<\/p>\n<p>3. Press: Enter<\/p>\n<p>If you completed the first two steps, you should now see this in the upper right-hand corner of your screen:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-220 size-full\" src=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150spotlight.png\" alt=\"\" width=\"482\" height=\"101\" srcset=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150spotlight.png 482w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150spotlight-300x63.png 300w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150spotlight-50x10.png 50w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150spotlight-60x13.png 60w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150spotlight-100x21.png 100w\" sizes=\"auto, (max-width: 482px) 100vw, 482px\" \/><\/p>\n<p>Select &#8220;Terminal&#8221; and press &#8220;Enter.&#8221; You will now want to execute the following command to open your hosts file with the nano text editor:<\/p>\n<p>sudo nano \/private\/etc\/hosts<\/p>\n<p>An example can be seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-219 size-full\" src=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts.png\" alt=\"\" width=\"1724\" height=\"1254\" srcset=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts.png 1724w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts-300x218.png 300w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts-768x559.png 768w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts-1024x745.png 1024w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts-50x36.png 50w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts-60x44.png 60w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150privhosts-100x73.png 100w\" sizes=\"auto, (max-width: 1724px) 100vw, 1724px\" \/><\/p>\n<p>You will be prompted for your password (the same one you use to login to your Desktop). Identical to the Windows host file, you simply add your IP address and domain, as pictured below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-218 size-full\" src=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit.png\" alt=\"\" width=\"1724\" height=\"1257\" srcset=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit.png 1724w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit-300x219.png 300w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit-768x560.png 768w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit-1024x747.png 1024w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit-50x36.png 50w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit-60x44.png 60w, https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150hostedit-100x73.png 100w\" sizes=\"auto, (max-width: 1724px) 100vw, 1724px\" \/><\/p>\n<p>To save your changes:<\/p>\n<p>Press CTRL+X<br \/>\nPress &#8220;y&#8221;<\/p>\n<p>You will need to flush your DNS resolver cache in order to ensure that these changes are honored by your next request for your domain. To do this, please see the following cPanel article, located <a href=\"https:\/\/docs.cpanel.net\/knowledge-base\/dns\/how-to-clear-your-dns-cache\/\" target=\"_blank\" rel=\"noopener\">here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide will provide a method of viewing\/testing a domain on Rochen&#8217;s servers without actually changing that domain&#8217;s global DNS over to Rochen&#8217;s network on both Windows and Mac OSX. Typically, this type of functionality is gained through using Apache&#8217;s mod_userdir, but this is actually a highly ineffective approach for&#8230;<\/p>\n","protected":false},"author":2,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[31,28],"ht-kb-tag":[116,114,100,115],"class_list":["post-214","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-installation-and-getting-started","ht_kb_category-domain-names-and-dns","ht_kb_tag-dev","ht_kb_tag-dns","ht_kb_tag-temporary-url","ht_kb_tag-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Modifying Your Hosts File - Rochen Documentation<\/title>\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.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Modifying Your Hosts File - Rochen Documentation\" \/>\n<meta property=\"og:description\" content=\"This guide will provide a method of viewing\/testing a domain on Rochen&#8217;s servers without actually changing that domain&#8217;s global DNS over to Rochen&#8217;s network on both Windows and Mac OSX. Typically, this type of functionality is gained through using Apache&#8217;s mod_userdir, but this is actually a highly ineffective approach for...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Rochen Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-29T10:15:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad.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:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/\",\"url\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/\",\"name\":\"Modifying Your Hosts File - Rochen Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/150adminnotepad.png\",\"datePublished\":\"2018-09-17T19:17:44+00:00\",\"dateModified\":\"2023-05-29T10:15:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/150adminnotepad.png\",\"contentUrl\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/150adminnotepad.png\",\"width\":471,\"height\":504},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/documentation\\\/modifying-your-hosts-file\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Modifying Your Hosts File\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/#website\",\"url\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/\",\"name\":\"Rochen Documentation\",\"description\":\"Official documentation for Rochen&#039;s web hosting services as well as helpful articles for CMS like WordPress, Joomla and Drupal.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rochen.com\\\/docs\\\/?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":"Modifying Your Hosts File - Rochen Documentation","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.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/","og_locale":"en_US","og_type":"article","og_title":"Modifying Your Hosts File - Rochen Documentation","og_description":"This guide will provide a method of viewing\/testing a domain on Rochen&#8217;s servers without actually changing that domain&#8217;s global DNS over to Rochen&#8217;s network on both Windows and Mac OSX. Typically, this type of functionality is gained through using Apache&#8217;s mod_userdir, but this is actually a highly ineffective approach for...","og_url":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/","og_site_name":"Rochen Documentation","article_modified_time":"2023-05-29T10:15:44+00:00","og_image":[{"url":"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/","url":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/","name":"Modifying Your Hosts File - Rochen Documentation","isPartOf":{"@id":"https:\/\/www.rochen.com\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/#primaryimage"},"image":{"@id":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad.png","datePublished":"2018-09-17T19:17:44+00:00","dateModified":"2023-05-29T10:15:44+00:00","breadcrumb":{"@id":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/#primaryimage","url":"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad.png","contentUrl":"https:\/\/www.rochen.com\/docs\/wp-content\/uploads\/2018\/09\/150adminnotepad.png","width":471,"height":504},{"@type":"BreadcrumbList","@id":"https:\/\/www.rochen.com\/docs\/documentation\/modifying-your-hosts-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rochen.com\/docs\/"},{"@type":"ListItem","position":2,"name":"Modifying Your Hosts File"}]},{"@type":"WebSite","@id":"https:\/\/www.rochen.com\/docs\/#website","url":"https:\/\/www.rochen.com\/docs\/","name":"Rochen Documentation","description":"Official documentation for Rochen&#039;s web hosting services as well as helpful articles for CMS like WordPress, Joomla and Drupal.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rochen.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/ht-kb\/214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/comments?post=214"}],"version-history":[{"count":5,"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/ht-kb\/214\/revisions"}],"predecessor-version":[{"id":2289,"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/ht-kb\/214\/revisions\/2289"}],"wp:attachment":[{"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/media?parent=214"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/ht-kb-category?post=214"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.rochen.com\/docs\/wp-json\/wp\/v2\/ht-kb-tag?post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}