{"id":82,"date":"2015-07-02T09:08:54","date_gmt":"2015-07-02T09:08:54","guid":{"rendered":"http:\/\/www.lgdhosting.co.uk\/support\/?p=82"},"modified":"2018-10-18T10:47:54","modified_gmt":"2018-10-18T10:47:54","slug":"previewing-a-test-website","status":"publish","type":"post","link":"https:\/\/www.lgdhosting.co.uk\/support\/website\/previewing-a-test-website\/","title":{"rendered":"Previewing a test website"},"content":{"rendered":"<p>If your new website is being developed on our servers while your old site using the same domain name is still live, to preview the new site you need to edit a text file on your computer.<\/p>\n<p>The <em>hosts<\/em> file controls where your web browser looks for your site and you need to edit this to redirect domain requests. The method used to do this depends on your operating system, see below.<\/p>\n<p>Note that these changes may also affect sending and receiving email if it uses the same domain name as the website, in which case immediately switch back the changes after previewing your site to restore your email sending\/receiving.<\/p>\n<p>You need to add the following lines to your hosts file (replacing domain.com with your site domain):<\/p>\n<p><code>213.129.84.87 www.domain.com<br \/>\n213.129.84.87 domain.com<\/code><\/p>\n<p>To switch back to seeing your live site, you can delete these lines or add # at the start of each line, eg:<\/p>\n<p><code># 213.129.84.87 www.domain.com<br \/>\n# 213.129.84.87 domain.com<\/code><\/p>\n<h2>Operating system<\/h2>\n<ul>\n<li><a href=\"#Windows\">Windows 10, Windows 8, Windows 7 and Windows Vista<\/a><\/li>\n<\/ul>\n<ul>\n<li><a href=\"#Windows_NT2000XP\">Windows NT\/2000\/XP<\/a><\/li>\n<\/ul>\n<ul>\n<li><a href=\"#Linux\">Linux<\/a><\/li>\n<\/ul>\n<ul>\n<li><a href=\"#macosx10\">Mac OSX 10.0 &#8211; 10.1.5<\/a><\/li>\n<\/ul>\n<ul>\n<li><a href=\"#macosx106\">Mac OSX 10.6 &#8211; 10.11<\/a><\/li>\n<\/ul>\n<p><a id=\"Windows\" name=\"Windows\"><\/a><\/p>\n<h2>Windows 10, Windows 8, Windows 7 and Windows Vista<\/h2>\n<p>Windows 8, Windows 7 and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.<\/p>\n<p><strong>For Windows 10 and Windows 8<\/strong><\/p>\n<ol>\n<li>Press the Windows key.<\/li>\n<li>Type Notepad in the search field.<\/li>\n<li>In the search right click Notepad and select <strong>Run as administrator<\/strong>.<\/li>\n<li>In Notepad, open the following file:<br \/>\nc:\\Windows\\System32\\Drivers\\etc\\hosts<br \/>\nto see this file in the Notepad file browser you will need to switch filetype from Text Documents (*.txt) to All Files (*.*)<\/li>\n<li>Make the necessary changes to the hosts file.<\/li>\n<li>Click <strong>File <\/strong>-&gt; <strong>Save <\/strong>to save your changes.<\/li>\n<\/ol>\n<p><strong>For Windows 7 and Windows Vista<\/strong><\/p>\n<ol>\n<li>For Click <strong>Start <\/strong>-&gt; <strong>All Programs<\/strong> -&gt; <strong>Accessories<\/strong>.<\/li>\n<li>Right click Notepad and select <strong>Run as administrator<\/strong>.<\/li>\n<li>Click <strong>Continue <\/strong>on the &#8220;Windows needs your permission&#8221; UAC window.<\/li>\n<li>When Notepad opens Click <strong>File <\/strong>-&gt; <strong>Open<\/strong>.<\/li>\n<li>In the filename field type:<br \/>\nC:\\Windows\\System32\\Drivers\\etc\\hosts<br \/>\nto see this file in the Notepad file browser you will need to switch filetype from Text Documents (*.txt) to All Files (*.*)<\/li>\n<li>Click <strong>Open<\/strong>.<\/li>\n<li>Make the necessary\u00a0changes to\u00a0the hosts file.<\/li>\n<li>Click <strong>File <\/strong>-&gt; <strong>Save <\/strong>to save your changes.<\/li>\n<\/ol>\n<p><a id=\"Windows_NT2000XP\" name=\"Windows_NT2000XP\"><\/a><\/p>\n<h2>Windows NT\/2000\/XP<\/h2>\n<ol>\n<li>Click <strong>Start <\/strong>-&gt; <strong>All Programs<\/strong> -&gt; <strong>Accessories <\/strong>-&gt; <strong>Notepad<\/strong>.<\/li>\n<li>Click <strong>File <\/strong>-&gt; <strong>Open<\/strong>.<\/li>\n<li>In the filename field type:<br \/>\nC:\\Windows\\System32\\Drivers\\etc\\hosts<\/li>\n<li>Click <strong>Open<\/strong>.<\/li>\n<li>Make the necessary\u00a0changes to\u00a0the hosts file.<\/li>\n<li>Click <strong>File <\/strong>-&gt; <strong>Save <\/strong>to save your changes.<\/li>\n<\/ol>\n<p><a id=\"Linux\" name=\"Linux\"><\/a><\/p>\n<h2>Linux<\/h2>\n<p>1. Open a terminal window.<\/p>\n<p>2. Open the hosts file in a text editor\u00a0(you can substitute any text editor):<br \/>\n<code>sudo nano \/etc\/hosts<\/code><br \/>\n3. Enter your password.<\/p>\n<p>4. Make the necessary\u00a0changes to\u00a0the hosts file.<\/p>\n<p>5. Press\u00a0<strong>control-X<\/strong> (hold control and hit X), then answer <strong>y<\/strong>\u00a0when asked if you want to save your changes.<\/p>\n<p><a id=\"macosx10\" name=\"macosx10\"><\/a><\/p>\n<h2>Mac OS X 10.0 &#8211; 10.5<\/h2>\n<p>1. Open <strong>\/Applications\/Utilities\/NetInfo Manager<\/strong>.<\/p>\n<p>2. To allow editing the NetInfo database, click the padlock in the lower left corner of the window.<\/p>\n<p>3. Enter your password and click <strong>OK<\/strong>.<\/p>\n<p>4. In the second column of the browser view, select the node named <code>machines<\/code>.\u00a0You will see entries for <code>-DHCP-<\/code>, <code>broadcasthost<\/code>, and <code>localhost<\/code> in the third column.<\/p>\n<p>5. Select the <code>localhost<\/code> item in the third column.<\/p>\n<p>6. Choose <strong>Duplicate <\/strong>from the <strong>Edit <\/strong>menu (the quickest way to create a new entry is to duplicate an existing one). A confirmation alert appears.<\/p>\n<p>7. Click <strong>Duplicate<\/strong>. A new entry called <code>localhost copy<\/code> appears, and its properties are shown below the browser view.<\/p>\n<p>8. Double-click the value of the <code>ip_address<\/code> property and enter the IP address of the other computer.<\/p>\n<p>9. Double-click the value of the <code>name<\/code> property and enter the hostname you want for the other computer.<\/p>\n<p>10. Click the <code>serves<\/code>\u00a0property and choose <strong>Delete <\/strong>from the <strong>Edit <\/strong>menu.<\/p>\n<p>11. Choose <strong>Save <\/strong>from the <strong>File <\/strong>menu. A confirmation alert appears.<\/p>\n<p>12. Click <strong>Update this copy<\/strong>.<\/p>\n<p>13. Repeat steps 6 through 12 for each additional host entry you wish to add.<\/p>\n<p>14. Choose <strong>Quit <\/strong>from the NetInfo Manager menu. You do not need to restart the computer.<\/p>\n<p><a id=\"macosx106\" name=\"#acosx106\"><\/a><\/p>\n<h2>Mac OS X 10.6 &#8211; 10.11<\/h2>\n<p>1. Open <strong>Applications <\/strong>&gt; <strong>Utilities <\/strong>&gt; <strong>Terminal<\/strong>.<\/p>\n<p>2. Backup the hosts file by typing (or pasting) the following in the Terminal window:<br \/>\n<code>sudo cp \/private\/etc\/hosts ~\/Documents\/hosts-backup<\/code><br \/>\nthen return, type your user password if prompted.<\/p>\n<p>3. Open the hosts file by typing (or pasting) the following in the Terminal window:<br \/>\n<code>sudo nano \/private\/etc\/hosts<\/code><br \/>\nthen return, type your user password if prompted.<\/p>\n<p>4. Edit the hosts file.\u00a0The hosts file contains some comments (lines starting with the <code>#<\/code> symbol), as well as some default hostname mappings (e.g. 127.0.0.1 \u2013 local host). Append your new mappings underneath the default mappings.<\/p>\n<p>5. Save the hosts file by\u00a0pressing <strong>Control+x<\/strong> and answering <strong>y<\/strong>.<\/p>\n<p>6. Make your changes take effect by flushing the DNS cache with the following command(s) in Terminal, followed bt return:<\/p>\n<p>for 10.6 (Snow Leopard)<\/p>\n<p><code>dscacheutil -flushcache<\/code><\/p>\n<p>for 10.7 (Lion) &#8211; 10.8 (Mountain Lion)<\/p>\n<p><code>sudo killall -HUP mDNSResponder<\/code><\/p>\n<p>for 10.9 (Mavericks)<\/p>\n<p><code>dscacheutil -flushcache;<\/code><code>sudo killall -HUP mDNSResponder<\/code><\/p>\n<p>for 10.10 (Yosemite) up to 10.10.3<\/p>\n<p><code>sudo discoveryutil mdnsflushcache;<\/code><code>sudo discoveryutil udnsflushcaches<\/code><\/p>\n<p>for 10.10.4 and above<\/p>\n<p><code>sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache flushed<\/code><\/p>\n<p>7. New mappings should now take effect but you may need to restart your browser.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If your new website is being developed on our servers while your old site using the same domain name is still live, to preview the new site you need to edit a text file on your computer. The hosts file controls where your web browser looks for your site and you need to edit this &hellip; <a class=\"read-more\" href=\"https:\/\/www.lgdhosting.co.uk\/support\/website\/previewing-a-test-website\/\">[continue reading]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-82","post","type-post","status-publish","format-standard","category-website","entry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":26,"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":328,"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/posts\/82\/revisions\/328"}],"wp:attachment":[{"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lgdhosting.co.uk\/support\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}