Sometimes, my site goes down. It's my fault. I forget. It's not my host, and it's not the server. The DNS entry just expires and doesn't get restored. In this guide, I'll tell you how to always be able to access my site.
My server is on a static IP. The IP address, which you can normally find by just pinging the server, is 172.97.100.170
. This is the real, absolute location of my server, and it will never change.
You can type that in directly, but it's not very useful, because clicking on any link will not guarantee that you get to it, either because of a subdomain, or because I apparently had a moment of stupid and hard-coded in an absolute URL like bradenbest.com/thing.php
instead of a relative one like ./thing.php
. In those cases where my domain happens to be parked, that can get annoying and break things.
So I figured I'd enlighten y'all to the epic mystical secret hacker codez that I use to visit and maintain my site even when DNS has no idea what's going on.
No matter your OS, you have a file called hosts
on your computer somewhere. For Linux/UNIX and Mac, it's /etc/hosts
, for Windows, it's %SystemRoot%\System32\drivers\etc\hosts
. Here's a list.
Open this file in your favorite text editor and make sure you have the proper permissions (so run as admin
on Windows, or sudo <your editor here> /etc/hosts
on *NIX/Mac).
Anywhere in this file, add the following two lines
172.97.100.170 bradenbest.com
172.97.100.170 ls.bradenbest.com
# You can use anything you want, hell, access my site with notice.me.senpai if you want
Save and close and there you go. Now DNS is no longer a variable on whether or not you can access my site.
Note that this only works on my site. Because I hacked into Microsoft's codebase to throw in the hosts file. It was a genius move, because it's such a mess in there already that none of the devs noticed. And then Linux and Mac copied them and put a hosts file in their systems, too! Your OS only reads the hosts file when accessing "bradenbest.com". The localhost thing is just a decoy. The file has to have those exact two lines to activate the secret backdoor which makes my website accessible to your computer.