URL stands for (Uniform Resource Locator)

URI stands for (Uniform Resource Identifier)

Both URL and URI are used to identify resources on the internet, but they have distinct meanings.


URL - Uniform Resource Locator

A specific type of URI that provides the location (address) of a resource along with the means to access it.

means its a specific type of URI that tells where the resource is located and how to access it (includes a protocol like Protocol (http, https, ftp), domain, path, and sometimes query parameters., etc.).

Example of URLs (all are also URIs):

  • https://www.google.com → Identifies and locates the Google homepage.
  • ftp://files.pramodboda.com/myfile.zip → Provides the file location and how to access it via FTP.
  • https://pramodboda.com/products?id=1234 → Identifies and locates a product page.

URI - Uniform Resource Identifier

A broader term that includes both URLs (which specify location) and URNs (which specify names without location).

means anything that uniquely identifies a resource.

Not all URIs are URLs. It can be a URL, a URN, or both.

Example of a URI:

  • mailto:[email protected] → Identifies an email address but doesn’t tell how to retrieve it.
  • isbn:0451450523 → Identifies a book by its ISBN number (URN, not a URL).
  • https://pramodboda.com/portfolio-page.html → Identifies and locates a webpage (Both a URL & URI).

Example in .env

✅ Correct (since it's a full web address)
API_URL=http://localhost:5000/api/
DB_USER_URI=postgres
DB_HOST_URI=localhost

❌ Less accurate (but would still work)
API_URI=http://localhost:5000/api/

Simple Analogy

  • URL is like a full address (house number, street, city, and country).
  • URI is like a name (it can be an address but may also just be an identifier).

Conclusion:

  • Every URL is a URI because it identifies a resource.
  • Not every URI is a URL, as some URIs only name a resource but don’t tell how to access it.

Enjoyed this post?

Stay updated with the latest tech trends! Follow me on Instagram: @pramodboda.codevik and @pramodboda.art.

let me know your thoughts! 👇