Changing the local hosts file ip can be very effective. For example when you want to move a site from one server to another (change IP).
Click here for a guide on how to setup a local host file DNS change
But how can you be sure that you are accessing your locally defined IP when you go to a website?
There are many local IP lookup tools out there, the most simple solution is to open a command line tool, like Command Prompt (on Windows) and type
Then type (input your own website):
ping yoursite.com
Which will then return your locally setup IP from your hosts file.
But in my case it doesn't!
I found out the problem was insane ISP caching (Internet Service Provider - the guys supplying you with internet)
So what I did was connect to my mobile internet (set up a hotspot) and then instantly I could see my local hosts file changes.
I am still searching for a better solution, but for now this is definitely working.