I have a line in /etc/hosts to rewrite something to localhost:
127.0.0.1 foo.bar
Can the equivalent be done without modifying the hosts file, somehow with an Apache rewrite or something like that?
I have a line in /etc/hosts to rewrite something to localhost:
127.0.0.1 foo.bar
Can the equivalent be done without modifying the hosts file, somehow with an Apache rewrite or something like that?
No. They are for different purposes and work on a completely different protocol.
/etc/hosts
affects client behavior on which IP it should resolve instead of using DNS.Host:
header.