Hosts 是無副檔名的系統文字檔,記錄「域名↔IP」對應關係。系統解析域名時優先讀取 Hosts,命中則直接連線,不再查詢 DNS,常用於加速訪問、屏蔽廣告、測試伺服器等。
Windows XP/2003/Vista/7/8/10/11:C:\Windows\System32\drivers\etc\hosts
快速開啟:Win+R → 輸入上述路徑 → Enter。
# 將 example.com 指向本地回環 127.0.0.1 example.com # 指定測試伺服器 IP 192.168.1.100 test.mysite.com
ipconfig /flushdns 刷新快取。