You could either list out all the domains or use something like dnsmasq or another DNS proxy that lets you define more sophisticated rules.
Edit: the advantages of the /etc/hosts approach are it's simple, and it works without additional software.
You could either list out all the domains or use something like dnsmasq or another DNS proxy that lets you define more sophisticated rules.
Edit: the advantages of the /etc/hosts approach are it's simple, and it works without additional software.