{"id":3057,"date":"2012-05-28T13:13:08","date_gmt":"2012-05-28T11:13:08","guid":{"rendered":"http:\/\/localhost\/helpcentre\/?p=3057"},"modified":"2025-12-29T13:33:43","modified_gmt":"2025-12-29T11:33:43","slug":"what-is-a-hosts-file-and-how-can-i-use-it-to-test-my-website","status":"publish","type":"post","link":"https:\/\/xneelo.co.za\/help-centre\/website\/what-is-a-hosts-file-and-how-can-i-use-it-to-test-my-website\/","title":{"rendered":"What is a hosts file and how can I use it to test my website?"},"content":{"rendered":"<p>Most common operating systems include a <b>hosts file<\/b>, which is used to translate a human friendly host name into an IP address used by the web browser to connect to the hosting server.<\/p>\n<p>This process forms part of your operating systems <a title=\"DNS\" href=\"https:\/\/xneelo.co.za\/help-centre\/domains\/what-is-dns\/\" target=\"_blank\" rel=\"noopener\">DNS<\/a> lookup in order to establish which server to connect to for your requested host name specified in your URL, i.e. <a title=\"\/\" href=\"\/\" target=\"_blank\" rel=\"noopener noreferrer\">\/<\/a>, will connect to the server hosting <b>xneelo.co.za<\/b>.<\/p>\n<p>Changing the contents of this file allows you to specify which IP address your DNS lookup should resolve the host name to thereby allowing you to test your website on a new server without <a title=\"updating the domains DNS records\" href=\"https:\/\/xneelo.co.za\/help-centre\/control-panel\/how-to-manage-a-domains-dns-records\/\" target=\"_blank\" rel=\"noopener\">updating the domains DNS records<\/a>. This will however only affect the computer that the hosts file is changed on.<\/p>\n<p><b>Note: This change should only be made temporarily for testing purposes. The added entry must always be deleted from the hosts file after testing has been concluded. <\/b><\/p>\n<p>To change the hosts file on a Windows 7, XP and Vista operating system, follow the steps below:<\/p>\n<div id=\"action_points\">\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li>Click <b>Start<\/b><\/li>\n<li>In the search field, search for \u201c<b>Notepad<\/b>\u201c<\/li>\n<li>Right-click on the result for \u201cNotepad\u201d<\/li>\n<li>Select \u201c<b>Run as Administrator<\/b>\u201c<\/li>\n<li>Navigate the hosts file, which is usually in the location: <b>C:WindowsSystem32driversetchosts<\/b><\/li>\n<li><b>Append<\/b> your entry to the bottom of the file as shown below in the following format: e.g. MyDomain.co.za MyIPaddress<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<div class=\"codeblock\"><code><span style=\"color: #000000;\"><br \/>\n<span style=\"color: #0000bb;\">MyDomain<\/span><span style=\"color: #007700;\">.<\/span><span style=\"color: #0000bb;\">co<\/span><span style=\"color: #007700;\">.<\/span><span style=\"color: #0000bb;\">za 197.221.22.12 <\/span><br \/>\n<\/span><br \/>\n<\/code><\/div>\n<ol>\n<li>Save the file by opening the \u201cFile menu\u201d and select \u201c<b>Save<\/b>\u201d<\/li>\n<\/ol>\n<\/div>\n<p><b>Note: Changes to this file will require administrative privileges. <\/b><\/p>\n<p>To change the hosts file on most common <b>Linux<\/b> distributions, follow the steps below:<\/p>\n<div id=\"action_points\">\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li>Open a <b>terminal session<\/b><\/li>\n<li>Open the hosts file usually located in the path, <b>\/etc\/hosts<\/b> in a text editor of your choice, i.e sudo nano \/etc\/hosts<\/li>\n<li><b>Append<\/b> the required line on a new line at the bottom of the file as shown below in the following format: MyDomain.co.za MyIPaddress<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<div class=\"codeblock\"><code><span style=\"color: #000000;\"><br \/>\n<span style=\"color: #0000bb;\">MyDomain<\/span><span style=\"color: #007700;\">.<\/span><span style=\"color: #0000bb;\">co<\/span><span style=\"color: #007700;\">.<\/span><span style=\"color: #0000bb;\">za 197.221.22.12 <\/span><br \/>\n<\/span><br \/>\n<\/code><\/div>\n<ol>\n<li><b>Save<\/b> the file and exit the editor<\/li>\n<\/ol>\n<\/div>\n<p><b>Note: Changes to this file will require root permissions<\/b><\/p>\n<p>To change the hosts file on most <b>Mac<\/b> versions, follow the steps below:<\/p>\n<div id=\"action_points\">\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li>Open a <b>terminal session<\/b><\/li>\n<li>Open the hosts file usually located in the path, <b>\/private\/etc\/hosts<\/b> in a text editor of your choice, i.e sudo nano \/private\/etc\/hosts<\/li>\n<li><b>Append<\/b> the required line on a new line at the bottom of the file as shown below in the following format: MyDomain.co.za MyIPaddress<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<div class=\"codeblock\"><code><span style=\"color: #000000;\"><br \/>\n<span style=\"color: #0000bb;\">MyDomain<\/span><span style=\"color: #007700;\">.<\/span><span style=\"color: #0000bb;\">co<\/span><span style=\"color: #007700;\">.<\/span><span style=\"color: #0000bb;\">za 197.221.22.12 <\/span><br \/>\n<\/span><br \/>\n<\/code><\/div>\n<ol>\n<li><b>Save<\/b> the file and exit the editor<\/li>\n<\/ol>\n<\/div>\n<p><b>Note: Changes to this file will require root permissions<\/b><\/p>\n<p>After the changes made to your hosts file have been saved, you may need to <a title=\"clear your operating system's cache\" href=\"https:\/\/xneelo.co.za\/help-centre\/website\/how-do-i-clear-my-dns-resolver-cache\/\" target=\"_blank\" rel=\"noopener\">clear your operating system\u2019s cache<\/a>.<\/p>\n<p>The website can now be tested as you normally would by browsing to the domain\u2019s URL. The website displayed will be the one located on the server with the IP address you specified in your hosts file.<\/p>\n<p><b>Note: Always ensure that you delete the lines you have added to the hosts file.<\/b><\/p>\n","protected":false,"plain":"Most common operating systems include a <b>hosts file<\/b>, which is used to translate a human friendly host name into an IP address used by the web browser to connect to the hosting server.\r\n\r\nThis process forms part of your operating systems <a title=\"DNS\" href=\"https:\/\/xneelo.co.za\/help-centre\/domains\/what-is-dns\/\" target=\"_blank\" rel=\"noopener\">DNS<\/a> lookup in order to establish which server to connect to for your requested host name specified in your URL, i.e. <a title=\"\/\" href=\"\/\" target=\"_blank\" rel=\"noopener noreferrer\">\/<\/a>, will connect to the server hosting <b>xneelo.co.za<\/b>.\r\n\r\nChanging the contents of this file allows you to specify which IP address your DNS lookup should resolve the host name to thereby allowing you to test your website on a new server without <a title=\"updating the domains DNS records\" href=\"https:\/\/xneelo.co.za\/help-centre\/control-panel\/how-to-manage-a-domains-dns-records\/\" target=\"_blank\" rel=\"noopener\">updating the domains DNS records<\/a>. This will however only affect the computer that the hosts file is changed on.\r\n\r\n<b>Note: This change should only be made temporarily for testing purposes. The added entry must always be deleted from the hosts file after testing has been concluded. <\/b>\r\n\r\nTo change the hosts file on a Windows 7, XP and Vista operating system, follow the steps below:\r\n<div id=\"action_points\">\r\n<ol>\r\n \t<li >\r\n<ol>\r\n \t<li>Click <b>Start<\/b><\/li>\r\n \t<li>In the search field, search for \u201c<b>Notepad<\/b>\u201c<\/li>\r\n \t<li>Right-click on the result for \u201cNotepad\u201d<\/li>\r\n \t<li>Select \u201c<b>Run as Administrator<\/b>\u201c<\/li>\r\n \t<li>Navigate the hosts file, which is usually in the location: <b>C:WindowsSystem32driversetchosts<\/b><\/li>\r\n \t<li><b>Append<\/b> your entry to the bottom of the file as shown below in the following format: e.g. MyDomain.co.za MyIPaddress<\/li>\r\n<\/ol>\r\n<\/li>\r\n<\/ol>\r\n<div class=\"codeblock\"><code><span >\r\n<span >MyDomain<\/span><span >.<\/span><span >co<\/span><span >.<\/span><span >za 197.221.22.12 <\/span>\r\n<\/span>\r\n<\/code><\/div>\r\n<ol>\r\n \t<li>Save the file by opening the \u201cFile menu\u201d and select \u201c<b>Save<\/b>\u201d<\/li>\r\n<\/ol>\r\n<\/div>\r\n<b>Note: Changes to this file will require administrative privileges. <\/b>\r\n\r\nTo change the hosts file on most common <b>Linux<\/b> distributions, follow the steps below:\r\n<div id=\"action_points\">\r\n<ol>\r\n \t<li >\r\n<ol>\r\n \t<li>Open a <b>terminal session<\/b><\/li>\r\n \t<li>Open the hosts file usually located in the path, <b>\/etc\/hosts<\/b> in a text editor of your choice, i.e sudo nano \/etc\/hosts<\/li>\r\n \t<li><b>Append<\/b> the required line on a new line at the bottom of the file as shown below in the following format: MyDomain.co.za MyIPaddress<\/li>\r\n<\/ol>\r\n<\/li>\r\n<\/ol>\r\n<div class=\"codeblock\"><code><span >\r\n<span >MyDomain<\/span><span >.<\/span><span >co<\/span><span >.<\/span><span >za 197.221.22.12 <\/span>\r\n<\/span>\r\n<\/code><\/div>\r\n<ol>\r\n \t<li><b>Save<\/b> the file and exit the editor<\/li>\r\n<\/ol>\r\n<\/div>\r\n<b>Note: Changes to this file will require root permissions<\/b>\r\n\r\nTo change the hosts file on most <b>Mac<\/b> versions, follow the steps below:\r\n<div id=\"action_points\">\r\n<ol>\r\n \t<li >\r\n<ol>\r\n \t<li>Open a <b>terminal session<\/b><\/li>\r\n \t<li>Open the hosts file usually located in the path, <b>\/private\/etc\/hosts<\/b> in a text editor of your choice, i.e sudo nano \/private\/etc\/hosts<\/li>\r\n \t<li><b>Append<\/b> the required line on a new line at the bottom of the file as shown below in the following format: MyDomain.co.za MyIPaddress<\/li>\r\n<\/ol>\r\n<\/li>\r\n<\/ol>\r\n<div class=\"codeblock\"><code><span >\r\n<span >MyDomain<\/span><span >.<\/span><span >co<\/span><span >.<\/span><span >za 197.221.22.12 <\/span>\r\n<\/span>\r\n<\/code><\/div>\r\n<ol>\r\n \t<li><b>Save<\/b> the file and exit the editor<\/li>\r\n<\/ol>\r\n<\/div>\r\n<b>Note: Changes to this file will require root permissions<\/b>\r\n\r\nAfter the changes made to your hosts file have been saved, you may need to <a title=\"clear your operating system's cache\" href=\"https:\/\/xneelo.co.za\/help-centre\/website\/how-do-i-clear-my-dns-resolver-cache\/\" target=\"_blank\" rel=\"noopener\">clear your operating system\u2019s cache<\/a>.\r\n\r\nThe website can now be tested as you normally would by browsing to the domain\u2019s URL. The website displayed will be the one located on the server with the IP address you specified in your hosts file.\r\n\r\n<b>Note: Always ensure that you delete the lines you have added to the hosts file.<\/b>"},"excerpt":{"rendered":"<p>Most common operating systems include a hosts file, which is used to translate a human friendly host name into an IP address. <\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"lsx_disable_title":"0","_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","footnotes":""},"categories":[218,166],"tags":[42],"topics":[],"class_list":["post-3057","post","type-post","status-publish","format-standard","hentry","category-managing-web-hosting","category-website","tag-website_caching"],"acf":[],"additional_meta":{"category_title":[{"term_id":218,"name":"Managing your Web Hosting","slug":"managing-web-hosting","term_group":0,"term_taxonomy_id":218,"taxonomy":"category","description":"Managing Web Hosting","parent":206,"count":3,"filter":"raw","term_order":"89","cat_ID":218,"category_count":3,"category_description":"Managing Web Hosting","cat_name":"Managing your Web Hosting","category_nicename":"managing-web-hosting","category_parent":206},{"term_id":166,"name":"Website","slug":"website","term_group":0,"term_taxonomy_id":166,"taxonomy":"category","description":"About your Website(s)","parent":0,"count":169,"filter":"raw","term_order":"120","cat_ID":166,"category_count":169,"category_description":"About your Website(s)","cat_name":"Website","category_nicename":"website","category_parent":0}],"tag_title":[{"term_id":42,"name":"Website caching","slug":"website_caching","term_group":0,"term_taxonomy_id":42,"taxonomy":"post_tag","description":"","parent":0,"count":3,"filter":"raw","term_order":"3036"}]},"featured_image_src":null,"author_info":{"display_name":"marketing","author_link":"https:\/\/xneelo.co.za\/help-centre\/author\/marketing\/","author_avatar":"https:\/\/secure.gravatar.com\/avatar\/a6ea315e112423b2b955cb020fbce2b0835956c6ad85ff0f13f1db298977eaaa?s=96&d=mm&r=g"},"_links":{"self":[{"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/posts\/3057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/comments?post=3057"}],"version-history":[{"count":0,"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/posts\/3057\/revisions"}],"wp:attachment":[{"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/media?parent=3057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/categories?post=3057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/tags?post=3057"},{"taxonomy":"topics","embeddable":true,"href":"https:\/\/xneelo.co.za\/help-centre\/wp-json\/wp\/v2\/topics?post=3057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}