{"id":374,"date":"2015-05-29T07:28:23","date_gmt":"2015-05-29T07:28:23","guid":{"rendered":"http:\/\/kb.veeble.org\/?p=374"},"modified":"2025-03-13T12:20:13","modified_gmt":"2025-03-13T06:50:13","slug":"modifying-your-host-file-to-override-dns-of-a-domain","status":"publish","type":"post","link":"https:\/\/www.veeble.com\/kb\/modifying-your-host-file-to-override-dns-of-a-domain\/","title":{"rendered":"Modifying your host file to override DNS of a domain"},"content":{"rendered":"\n<p>This article will guide&nbsp;you on how to add an entry in your machine&#8217;s host file to lookup up the A record for a domain directly without DNS name resolution, this is commonly used for the testing website before changing the name server as it will override the DNS settings on that particular machine where you edit the host file. This is a good way to test a site before you have transferred the domain from your old server to the new server.<\/p>\n\n\n\n<p><strong>Windows<\/strong><\/p>\n\n\n\n<p>You need to open and edit the host file using notepad with administrator privilege.<\/p>\n\n\n\n<p>Step1: Navigate to notepad<br>step2: Right-click notepad and select &#8221; Run as administrator&#8221;<br>Step3: Open c:\\Windows\\System32\\Drivers\\etc\\hosts<br>Step 4: Add the following entry.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">IPaddress domain.com\nIPaddress www.domain.com\n\nfor example:\n\n89.237.107.170 &nbsp;veeble.org\n89.237.107.170 &nbsp;www.veeble.org<\/pre>\n\n\n\n<p>In the above example, replace the domain name and IP address with your actual domain name and IP address.<\/p>\n\n\n\n<p>Finally your host-file should look like.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Copyright (c) 1993-2009 Microsoft Corp.\n\n#\n# This is a sample HOSTS file used by Microsoft TCP\/IP for Windows.\n#\n# This file contains the mappings of IP addresses to host names. Each\n# entry should be kept on an individual line. The IP address should\n# be placed in the first column followed by the corresponding host name.\n# The IP address and the host name should be separated by at least one\n# space.\n#\n# Additionally, comments (such as these) may be inserted on individual\n# lines or following the machine name denoted by a '#' symbol.\n#\n# For example:\n#\n# 102.54.94.97 rhino.acme.com # source server\n# 38.25.63.10 x.acme.com # x client host\n\n# localhost name resolution is handled within DNS itself.\n# 127.0.0.1 localhost\n# ::1 localhost\n89.237.107.170 veeble.org\n89.237.107.170 www.veeble.org<\/pre>\n\n\n\n<p>Step 5: Save the file and access the website using your favorite web browser.<\/p>\n\n\n\n<p><strong>Linux<\/strong><\/p>\n\n\n\n<p>step1: Open the Linux terminal<br>step2: Open the host file using your favorite editor (here we use &#8220;nano editor&#8221;).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#sudo nano \/etc\/hosts\n\nEnter the password<\/pre>\n\n\n\n<p>Step 3: Add the following lines into your host file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">IPaddress domain.com\nIPaddress www.domain.com\n\nfor example:\n\n89.237.107.170 veeble.org \n89.237.107.170 www.veeble.org<\/pre>\n\n\n\n<p>In the above example, replace the domain name and IP address with yours.<\/p>\n\n\n\n<p>Step 4: Press control+X, then answer &#8220;y&#8221; to save the changes.<\/p>\n\n\n\n<p>That&#8217;s it!<br>Go and access your website using any web browser!<\/p>\n\n\n\n<p><strong>Mac<\/strong><\/p>\n\n\n\n<p>Step1: Open Mac&#8217;s terminal<br>Step2: Open the host file by entering the following command on your terminal.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#sudo nano \/private\/etc\/hosts\n\nYou are required to enter the Mac user's password and press return.<\/pre>\n\n\n\n<p>Step 3: Add the following entries to the bottom of your host file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">IPaddress domain.com\nIPaddress www.domain.com\n\nfor example:\n\n89.237.107.170 veeble.org\n89.237.107.170 www.veeble.org<\/pre>\n\n\n\n<p>In the above example, replace the domain name and IP address with yours.<\/p>\n\n\n\n<p>Step4: Save the changes by pressing control+o, then return to accept the filename.<br>Step5: Exit the editor by pressing control+x. You are now at the terminal screen.<br>Step6: Flush your Mac&#8217;s DNS cache by entering the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#sudo dscacheutil -flushcache<\/pre>\n\n\n\n<p>Done!<br>Access the website in your browser and make sure everything is fine.<\/p>\n\n\n\n<p>Note:- Please remove the entries when testing is complete.<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-12c26e88 wp-block-button\"><div class=\"uagb-cta__wrap\"><h3 class=\"uagb-cta__title\"><strong>Future-Proof Your Business with Enterprise-Grade AWS Hosting!<\/strong><\/h3><p class=\"uagb-cta__desc\"><em>Veeble\u2019s AWS experts handle migrations, scaling, and threat detection\u2014so your apps run smoother, faster, and safer. Reclaim your time and let us manage the cloud heavy lifting. Launch in minutes!<\/em><\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/www.veeble.com\/in\/managed-aws-hosting\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_blank\" rel=\"noopener noreferrer\">View Pricing<svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path d=\"M504.3 273.6l-112.1 104c-6.992 6.484-17.18 8.218-25.94 4.406c-8.758-3.812-14.42-12.45-14.42-21.1L351.9 288H32C14.33 288 .0002 273.7 .0002 255.1S14.33 224 32 224h319.9l0-72c0-9.547 5.66-18.19 14.42-22c8.754-3.809 18.95-2.075 25.94 4.41l112.1 104C514.6 247.9 514.6 264.1 504.3 273.6z\"><\/path><\/svg><\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article will guide&nbsp;you on how to add an entry in your machine&#8217;s host file to lookup up the A record for a domain [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":7777,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-374","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"uagb_featured_image_src":{"full":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/05\/Modifying-your-host-file-to-override-DNS-of-a-domain.jpg",1366,768,false],"thumbnail":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/05\/Modifying-your-host-file-to-override-DNS-of-a-domain-150x150.jpg",150,150,true],"medium":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/05\/Modifying-your-host-file-to-override-DNS-of-a-domain-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/05\/Modifying-your-host-file-to-override-DNS-of-a-domain-768x432.jpg",768,432,true],"large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/05\/Modifying-your-host-file-to-override-DNS-of-a-domain-1024x576.jpg",1024,576,true],"1536x1536":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/05\/Modifying-your-host-file-to-override-DNS-of-a-domain.jpg",1366,768,false],"2048x2048":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/05\/Modifying-your-host-file-to-override-DNS-of-a-domain.jpg",1366,768,false]},"uagb_author_info":{"display_name":"Vipin Raj","author_link":"https:\/\/www.veeble.com\/kb\/author\/vipin\/"},"uagb_comment_info":0,"uagb_excerpt":"This article will guide&nbsp;you on how to add an entry in your machine&#8217;s host file to lookup up the A record for a domain [&hellip;]","_links":{"self":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":15,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":8052,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/374\/revisions\/8052"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media\/7777"}],"wp:attachment":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}