What parts of URL address do you know and what are they good for?

Experience Level: Junior
Tags: HTTP protocol Quality Assurance (QA)

Answer

As an example let's take the following URL:

https://www.bettercoder.io/JobInterviewQuestions/?q=My+query&a=112#lng=en-US

  • Protocol - https (the part before ://)
    • Thanks to protocol the HTTP client (browser) and the server know how to communicate, whether to use encrypted data transport or not
  • Domain/Subdomain - www.bettercoder.io (the first part after ://)
    • Thanks to the domain the HTTP client (browser) knows to which server it should connect.
  • Path - /JobInterviewQuesions/ (the part between :// and ?)
    • Thanks to the path the HTTP client (browser) knows what resource (web page) to ask for on the server 
  • Query string - ?q=My+query&a=112 (the part between ? and #)
    • Query string gives the developer option to pass additional parameters in the URL (for example for filtering purposes)
  • Hash portion - #lng=en-US (the part after #)
    • Hash portion is used to navigate to the specific anchor in browser. It can also be used by front-end applications to route between pages.
Related Quality Assurance (QA) job interview questions
HTTP protocol for beginners
HTTP protocol for beginners

Are you learning Quality Assurance (QA)? Try our test we designed to help you progress faster.

Test yourself