Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know I can map URLs to other URLs via the host file, but can I map a URL to a local html file on my hard drive without running a local server and loading the html file through there? Something like:


I'd like to know how to do this on both Mac and Windows.

share|improve this question
Actually, you're not mapping URLs at all. You're just resolving a hostname. – ckhan Feb 26 '13 at 15:49
What are you trying to do? Do you actually want to display a certain HTML page when attempting to access Google or do you just want to display a local HTML file in your browser? – Dennis Feb 26 '13 at 15:55
@ckhan thx. i'm not suprised that my vocab was off on this one – maxedison Feb 26 '13 at 16:15
up vote 7 down vote accepted

No you cannot.

The hosts file is for mapping hostnames to IP addresses (and not "URLs"), expecially where a DNS server is not available, or where there's a need to override entries in a DNS server.

A file has no hostname/IP address, thus, what you're asking is not possible.

If you want to read more on this subject:

share|improve this answer
Thanks for both answering my question and helping clear up my vocab ;) – maxedison Feb 26 '13 at 16:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.