How to refer to main domain without hard-coding its name?

后端 未结 4 2078
半阙折子戏
半阙折子戏 2021-02-19 22:01

I have a domain name: TestSite.com. I create several subdomains for this site and refer to them as first.TestSite.com, second.TestSite.com, etc.

How do I refer to TestSi

4条回答
  •  孤独总比滥情好
    2021-02-19 22:26

    An alternate solution would be to use the original domain name for the live server, but point it to your development environment.

    You can override DNS lookups in Windows by adding lines to this file.

    C:\Windows\System32\drivers\etc\hosts

    Add the following using a text editor.

    127.0.0.1   www.livesite.com
    127.0.0.1   first.livesite.com
    127.0.0.1   second.livesite.com
    

    These domains will now map to the locahost. So there won't be a need to hack HTML for testing.

提交回复
热议问题