This shows you the differences between two versions of the page.
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 | + | |
- | * / | + | * 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: / | ||
+ | * Open the file with a simple text editor like windows notepad or notepad++ | ||
+ | * To add an entry, | ||
* [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 | + | < |
- | * Should | + | * Save file. You may need to give windows elevated permission to save |
- | * should | + | ===Clearing dns==== |
- | * $ipconfig /flushdns | + | * Open a browser and clear cache or do private browsing |
+ | * Sometimes it helps to run flush dns: | ||
+ | * Press the key combo " | ||
+ | * 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 " | ||
+ | * type in " | ||
+ | * You are now in the windows command prompt and can run the traceroute command | ||
+ | * Example: | ||
+ | < | ||
+ | * This will give you long readout, but will show you the ip of your website first, you can ignore the trace. | ||
+ | * example: | ||
+ | < | ||
+ | |||
+ | Tracing route to mywebsite.com [44.44.44.44]</ | ||
+ | * Once you have modified the host file, and following our example, you would see something like: | ||
+ | < | ||
+ | |||
+ | Tracing route to mywebsite.com [11.22.33.44]</ | ||
+ | |||
+ | === 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: | ||
+ | < | ||
+ | |||
+ | === Multiple lines === | ||
+ | You can add multiple lines of code and various ones commented out. your host file can look like this: | ||
+ | < | ||
+ | #4.3.2.1 google.com | ||
+ | 55.66.77.88 testsitenumber2.com | ||
+ | </ | ||
+ | In this example it would only change the first and third dns entry. The google entry would not affect how your computer reaches google. | ||