With my laptop, when accessing a given domain on the local network, I need to use a local IP address (192.168.x.x).
When accessing the same domain from a remote location, I need to use the public IP address. Since I am accessing the domain via DNS, which always returns the public IP address, how can I make things work using the same domain name regardless of whether I am on the local network or not, without tweaking my hosts file whenever I change locations(which is what I currently do to fix this situation).
You need to run an internal DNS server which has the correct internal IP addresses in it.
That DNS server's address could then be picked up from DHCP settings on the LAN.
I can see you having two possible solutions.
One, setup a VPN of some sort so even while on the road you have direct connectivity to your internal network.
Stop making changes to the hosts file, and instead setup split horizon so when a host is on the inside it gets the inside address, and when a host is on the outside it gets the outside address.
Would DynaDNS.org be of any assistance?