urlnamingurl-design

What's the difference between a URL such as "a.b.example" instead of "b.example/a"?


Why do some websites I see have a URL in the form a.b.example, and others are in the form of b.example/a?

For example, why is it gist.github.com instead of github.com/gist?


Solution

  • These are different components. See section 3 of the URI standard for a list of components and their definitions.

    https://gist.github.com/
    
    https://github.com/gist
    

    As https://gist.github.com/ would typically also have paths like the second URI (e.g., https://gist.github.com/foobar), I guess you are primarily interested in the authority component.

    In your examples, the DNS gets used, i.e., these are domains, which consist of labels, separated by .:

    The top level controls the second level, the second level controls the third level, and so on. So if you buy the domain name github.com, you typically have control about all of its third-level domains (and fourth-level, etc.).

    It’s up to the webmaster which kind of URI design gets used, and the decision can depend on many different factors: what is technically possible for them and the systems they use, usability (example), SEO (example), etc. A common reason for using different host names (domains) is that they can be easily hosted on different servers.

    Examples: