Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct name for each slash-separated piece of a file/URL path?

What is a 'piece' of a path called? (Including folder names, file names, and stuff like .. or .)

../foo/bar/baz
↑   ↑   ↑   ↑

or

https://example.com/foo/bar/baz
                     ↑   ↑   ↑

And does the terminology vary by OS or context?

like image 485
callum Avatar asked Jul 07 '16 11:07

callum


People also ask

What are the slashes in URL called?

A trailing slash is a forward slash (“/”) placed at the end of a URL such as domain.com/ or domain.com/page/. The trailing slash is generally used to distinguish a directory which has the trailing slash from a file that does not have the trailing slash.

What is the path part of a URL?

The path refers to the exact location of a page, post, file, or other asset. It is often analogous to the underlying file structure of the website. The path resides after the hostname and is separated by “/” (forward slash).

What is a trailing slash in URL?

What is a trailing slash? A trailing slash is a forward slash placed at the end of a URL. It's usually used to indicate a directory (as opposed to a file), but in SEO it can affect your rankings. Take a look at the URLs below and guess which one is 'correct'.


1 Answers

The terminology varies by context. For most web sites and web applications, the entire path together is taken at once and called, unsurprisingly, path. This follows the standard set forth in RFC 3986, though the standard is still loosely defined throughout the whole document.

For web applications that use parts of the uri as parameters to functions (such as Codeigniter), those pieces are referred to as segments. The reasoning behind Codeigniter's naming convention is derived from the design of the application. Each segment has a purpose, and the purpose is not always to locate the page or function that a user is accessing. Some of the segments are used as parameters to functions just as one might use a query string to pass variables through the uri.

like image 83
Jacob Avatar answered Nov 12 '22 17:11

Jacob