wildcard in hosts file

后端 未结 4 1820
花落未央
花落未央 2021-02-10 16:48

It\'s not possible to use a wildcard in the hosts file on windows or linux. Is there a way to do it with a browser plugin or something else?

I have a dev server on a vbo

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-10 17:36

    Instead of editing hosts file (which does not work for your requirement), setup a DNS server and setup Wildcard DNS A record -- like

    *.example.dev IN  A  1.2.3.4
    

    You mentioned subdomains, but I am assuming you actually want host entries (A address entries) under example.dev. Now abcd.example.dev indicates "abcd" is a host entry, and not a subdomain. Only if you say xyz.abcd.example.dev, then "abcd" becomes a subdomain. The key point is to say - since you want only abcd.example.dev - then you need only DNS A records and it is suggested as above.

提交回复
热议问题