URL 實際上是什麼
(統一資源定位符)就是你所請求的地址。它看起來像一長串字元,但其實是幾個帶標籤的部分縫接而成。把它拆開來看:
https://shop.example.com/products/shoes?size=10
https scheme — how to talk (use HTTPS, the secure way)
shop.example.com host — which server to talk to
/products/shoes path — which page or thing you want from it
?size=10 query — extra details ("the size-10 ones")
像讀一個倒過來的郵政地址那樣讀它:
- scheme(
https)是協議——對話的規則。如今幾乎總是https。 - host(
shop.example.com)指明要聯絡哪一臺伺服器。 - path(
/products/shoes)指明你想要那臺伺服器上的哪樣東西。 - 可選的 query(
?size=10)攜帶額外引數,比如篩選條件或搜尋詞。
當有人說“端點”或“路由”時,他們幾乎總是指某臺特定 host 上某個特定 path。那些嚇人的詞的全部含義也就是這些。