If you own your own domain, and you resort to local hosts file trickery to get a test version running on your localhost, you don’t have to do that anymore.
If you own example.com, and use dev.example.com as your localhost version of the site, you can create a CNAME entry for the dev subdomain that points to localhost. You can then clear out your hosts file.