Please believe jim mcnamara in that localhost is NOT a valid path used to locate executable commands/programs in your directory structure. If found in /etc/hosts , it can be resolved (by the resolver ) if part of a URL.
EDIT:
But then, as a part of a URL, use it correctly, e.g. file://localhost/tmp The /etc/hosts entry does not map but connects IP_address canonical_hostname [aliases...] .