How do I set up the hosts file for multiple domains/hosts with the same IP?

前端 未结 3 1479
自闭症患者
自闭症患者 2020-12-13 08:51

As you surely know you can map host names to IP addresses with the \"hosts\" file. This is very useful especially when you are developing as you can change localhost for pro

3条回答
  •  离开以前
    2020-12-13 09:42

    There are two highly voted answers at the time of writing - one putting all the aliases on a single line and the other putting them on separate lines. It's worth noting that whilst the first solution is more compact, the second may also be needed since Windows has a limit of 9 for the number of aliases on each line. So to have maximum compactness but still work when there are a lot of aliases:-

    127.0.0.1 alias1 alias2 alias3 alias4 alias5 alias6 alias7 alias8 alias9
    127.0.0.1 alias10 alias11 alias12 alias13 alias14 alias15 alias16 alias17 alias18 
    127.0.0.1 alias19 ...etc...
    

提交回复
热议问题