Skip to main content

Beginner-Friendly Topic

Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!

Lesson 2 of 9

URL Anatomy & Path Types

Understanding URLs (Uniform Resource Locators) is essential for web development. A URL is an address that tells the browser exactly where to find a resource on the internet. Every link you create uses a URL, so understanding their structure helps you write correct links and debug navigation issues.

15 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

URL Structure Breakdown

A URL has several parts:

https://www.example.com:443/blog/post?id=5&sort=date#comments

  1. 1Protocol (https://) β€” How the browser communicates with the server.
  2. 2Domain (www.example.com) β€” The server's address.
  3. 3Port (:443) β€” Default for HTTPS.
  4. 4Path (/blog/post) β€” The specific page or resource.
  5. 5Query String (?id=5&sort=date) β€” Extra data sent to the server.
  6. 6Fragment (#comments) β€” Jumps to a specific section on the page.

Path Types:
β€’ Absolute URL: https://www.example.com/page
β€’ Root-relative: /page
β€’ Relative: page.html or ../page.html

Diagram
Loading diagram…

Understanding absolute vs relative URL paths in HTML links

Path Types Comparison

  • Absolute (https://example.com/page) β€” Full URL. Use for external links.
  • Root-relative (/blog/page.html) β€” From domain root. Best for internal links.
  • Relative (page.html) β€” Same folder. Breaks if file moves.
  • Relative parent (../page.html) β€” One folder UP.
  • Fragment only (#section) β€” Same page anchor.

Quick Quiz

Key Takeaways

  • Understanding URLs (Uniform Resource Locators) is essential for web development.
  • Absolute (https://example.com/page) β€” Full URL. Use for external links.
  • Root-relative (/blog/page.html) β€” From domain root. Best for internal links.
  • Relative (page.html) β€” Same folder. Breaks if file moves.

Hands-on Practice Tools for this Course

Test what you learn using these free in-browser developer utilities (no signup required).

All 40+ Tools

Topics in This Module

0/9 done