User Tools

Site Tools


hstarwiki:cust:gen:hostfile

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
hstarwiki:cust:gen:hostfile [2016-09-11 T 18:52]
admin created
hstarwiki:cust:gen:hostfile [2017-08-07 T 23:09] (current)
admin
Line 1: Line 1:
 ====== Host file ====== ====== Host file ======
 ==== Edit for testing ==== ==== Edit for testing ====
-Host file locations: +If you are working on a temporary site that is located at a different location, you may need to change how your computer uses DNS on that page. You do this by editing the Host file. Here are the steps: 
-  * %SystemRoot%\System32\drivers\etc\hosts - Windows + 
-  * /etc/hosts - Unix +  * Figure out what you want to change, for example: 
-  * For testing would add line:+  * mywebsite.com has a development version on a dns server at 11.22.33.44 
 +  * Open the host file, here are the locations: 
 +  * Windows: C:\Windows\System32\drivers\etc\hosts 
 +  * Unix: /etc/hosts 
 +  * Open the file with a simple text editor like windows notepad or notepad++ 
 +  * To add an entry, add the line:
   * [ip of server location] [domain]   * [ip of server location] [domain]
-  * ex+  * So in the above example, the line will be
-  * 216.57.71.209 gloryholesports.com +<code>11.22.33.44 mywebsite.com </code> 
-  * Should clear cache or do private browsing +  * Save file. You may need to give windows elevated permission to save 
-  * should run from windows cmd+===Clearing dns==== 
-  * $ipconfig /flushdns+  * Open a browser and clear cache or do private browsing to test. 
 +  * Sometimes it helps to run flush dns: 
 +  * Press the key combo "Windows Key + R" (without quotations and +) to open a command prompt 
 +  * Type this and press return
 +  * ipconfig /flushdns 
 +  * Also, you may need to restart your computer after clearing your cache 
 +===Testing=== 
 +A good way to check if you have made the correct changes is to use traceroute. It helps to do this before so you know the current IP and can see the difference: 
 +  * Open Press the key combo "Windows + R" (without quotations) to open a command prompt 
 +  * type in "cmd" and press enter 
 +  * You are now in the windows command prompt and can run the traceroute command 
 +  * Example: 
 +<code>C:\Users\myuser>tracert mywebsite.com </code> 
 +  * This will give you long readout, but will show you the ip of your website first, you can ignore the trace. 
 +  * example: 
 +<code>C:\Users\myuser>tracert mywebsite.com 
 + 
 +Tracing route to mywebsite.com [44.44.44.44]</code> 
 +  * Once you have modified the host file, and following our example, you would see something like: 
 +<code>C:\Users\myuser>tracert mywebsite.com 
 + 
 +Tracing route to mywebsite.com [11.22.33.44]</code> 
 + 
 +=== Commenting out and reverting=== 
 +When you are done with the host file, you should either delete the line in the host file, or comment it out. Commenting it out leaves the line in to be activated later. To comment out just add a hash mark # before the line. SO the host file would look like: 
 +<code>#11.22.33.44 mywebsite.com </code> 
 + 
 +=== Multiple lines === 
 +You can add multiple lines of code and various ones commented out. your host file can look like this: 
 +<code>11.22.33.44 mywebsite.com  
 +#4.3.2.1 google.com 
 +55.66.77.88 testsitenumber2.com 
 +</code> 
 +In this example it would only change the first and third dns entry. The google entry would not affect how your computer reaches google. 
  
hstarwiki/cust/gen/hostfile.1473619953.txt.gz · Last modified: 2017-03-03 T 17:15 (external edit)