I am a web developer by trade and I am looking to streamline my local developing experience in the following way. As a precursor to my question, I have Apache and MySQL running locally on my PC. Currently, if I pull down a new client's website for development (let's say www.somedomain.com); I create an Apache virtualhost for dev.somedomain.com AND a hosts file entry to resolve dev.somedomain.com to a local IP address. Frequently I find hard-coded absolute URL's which requires me to find/replace, make site changes, find replace again, then upload.
What I would like to do is develop locally as www.somedomain.com, run a script to change my PC's settings, upload files, then check on the WWW to make sure everything is ok. Currently I have a script that 1) switches the default hosts file with the one I made with my site entries (or vice versa) -and- 2) flushes the local DNS cache.
So, I boot up the PC and my hosts file is default. I type www.somedomain.com into my browser and online content from the web is displayed. Now here's the problem. I run my switch script which swaps hosts files to the one having an entry for www.somedomain.com and flushes the local DNS cache. If I ping www.somedomain.com it resolves locally. if I ipconfig /displaydns it is listed as having a local IP address... problem is, it takes almost 5 minutes for any browser to start displaying local content.
I have tried clearing browser cache.
I have tried hard refresh.
I have tried stopping/starting Apache.
I have tried stopping/starting local DNS service.
I have tried killing local DNS service altogether.
I have tried altering the registry to locally cache DNS entries for only a few seconds.
If I wait a few minutes, www.somedomain.com starts displaying locally served content like it should. SO... I run my switch script again and the reverse happens. Ping and displaydns show outside-world IP's but the browsers take about 5 minutes to reflect changes.
Bottom line ::: I hope to find a way for the change to be instantaneous in my web browsers.