What do you call the entire first part of a URL?

后端 未结 8 1614
误落风尘
误落风尘 2020-12-12 23:35

If I have a URL like:

http://www.example.com:9090/test.html

Then I know that www.example.com is the host name, but what do you

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 00:13

    • http:// - Protocol
    • www - Server-Name (subdomain)
    • example - Second Level Domain (SLD)
    • com - Top Level Domain (TLD)
    • 9090 - Port number
    • /test.html - Path

    Save the protocol, you can refer to 'www.example.com' as either the hostname or - more specifically - the 'fully qualified domain name'.

    Toss in the '9090' and personally I'd be comfortable calling it the host, as that's usually what you'd get as the 'host' header in an HTTP request; something like 'host: www.example.com:9090'. In PHP it would be stored in the $_SERVER variable under 'HTTP_HOST' or 'SERVER_NAME'. In JavaScript it would be available as the document.location.host.

    I dunno what you could call it once you toss in 'http://' :(

提交回复
热议问题