URL Path

Share

What is an URL Path?

An URL path is the part of an URL after the domain name, e.g. /articles/2546/url-path in https://www.virtualcuriosities.com/articles/2546/url-path, but before an interrogation mark (?) or hash sign (#).

All URLs on the web have a path, and they all start with a forward slash (/).

For example, if you type google.com in your address bar, you'll go to Google's homepage, whose URL is https://www.google.com/. We can split this URL into three parts: the protocol, https, the domain name, www.domain.com, and the URL path, /.

Complicated Cases

Some URLs contain the port to connect to, and an IP address instead of a domain name. The path always goes after these parameters. For example, in the URL http://127.0.0.1:8080/search, the path is /search.

The path doesn't include the query parameters and fragment in the URL, e.g. if the URL ends in /search?q=123&sort=newest#results, then /search is the path, ?q=123&sort=newest are the query parameters, and #results is the fragment.

Some URLs don't have paths, but they aren't URLs for webpages. For example, blob, data, mailto, and tel protocols don't have a path. Conversely, some non-HTTP protocols do have paths, such as ftp, and git.

External Knowledge

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *