How to put wildcard entry into /etc/hosts?

hosts, subdomain, wildcard

Solution

It happens that `/etc/hosts` file doesn't support wild card entries.

You'll have to use other services like dnsmasq. To enable it in dnsmasq, just edit `dnsmasq.conf` and add the following line:

address=/example.com/127.0.0.1

Problem

I recently wanted to point all subdomains for a test domain, let's say example.com to the localhost. Is there a way to point all requests on *.example.com to resolve to 127.0.0.1

Original source