This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
hstarwiki:cust:gen:hostfile [2016-09-11 T 19:04] admin |
hstarwiki:cust:gen:hostfile [2017-08-07 T 23:09] (current) admin |
||
---|---|---|---|
Line 6: | Line 6: | ||
* mywebsite.com has a development version on a dns server at 11.22.33.44 | * mywebsite.com has a development version on a dns server at 11.22.33.44 | ||
* Open the host file, here are the locations: | * Open the host file, here are the locations: | ||
- | * C: | + | * Windows: |
- | * / | + | * Unix: / |
- | * Open the file with a simple text editor like notepad or notepad++ | + | * Open the file with a simple text editor like windows |
* To add an entry, add the line: | * To add an entry, add the line: | ||
* [ip of server location] [domain] | * [ip of server location] [domain] | ||
* So in the above example, the line will be: | * So in the above example, the line will be: | ||
- | * 11.22.33.44 | + | < |
* Save file. You may need to give windows elevated permission to save | * Save file. You may need to give windows elevated permission to save | ||
+ | ===Clearing dns==== | ||
* Open a browser and clear cache or do private browsing to test. | * Open a browser and clear cache or do private browsing to test. | ||
* Sometimes it helps to run flush dns: | * Sometimes it helps to run flush dns: | ||
- | * Press the key combo Windows + R | + | * Press the key combo "Windows |
* Type this and press return: | * Type this and press return: | ||
* ipconfig /flushdns | * 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. | ||
+ | |||