Reputation: 8885
What term do you give the part of the url after the last slash, but before the query? It seems most places people call it "the last part of the path" e.g. here but that is just so... wordy.
E.g. "something" in this url:
http://www.example.com/path/to/something?param=foo
Update:
I was hoping there was a well-known answer that I was not aware of, but it seems there is still some debate so, that's my answer right there. Guess I'll just keep calling it "the part of the path after the last slash". But I'll leave this question open anway, in case someone makes a convincing argument that gets lots of upvotes.
Upvotes: 12
Views: 18966
Reputation: 81
I'm a bit late to the party, but where I work we call it the slug, as mentioned here for example: https://prettylinks.com/2018/03/url-slugs/
Upvotes: 8
Reputation: 1417
I found the terms "last segment" or "last chunk" quite accurate and succinct.
Upvotes: 2
Reputation: 2492
I saw a few uncertain suggestions here and there, including "filename", "basename". The Qt project has these names in their lexicon, so it can serve as a standard.
Namely check out the QFileInfo class.
They have standardized the names as the following:
QFileInfo fi("/tmp/archive.tar.gz");
fi.fileName(); // "archive.tar.gz"
fi.baseName(); // "archive"
fi.completeBaseName(); // "archive.tar"
fi.suffix(); // "gz"
fi.completeSuffix(); // "tar.gz"
This is a specification for local files however, so in this standard, there is a departure from basic URI
terminology here:
fi.path(); // "/tmp"
fi.filePath(); // "/tmp/archive.tar.gz"
Where as in QUrl, you have path
& fileName
QUrl("file:file.txt").path(); // "file.txt"
QUrl("/home/user/file.txt").path(); // "/home/user/file.txt"
QUrl("http://www.example.com/test/123").path(); // "/test/123"
and
QUrl("file:file.txt").fileName(); // "file.txt"
QUrl("/home/user/file.txt").fileName(); // "file.txt"
QUrl("http://www.example.com/test/123").fileName(); // "123"
If I were building a library, I personally would adopt QFileInfo
terminology and apply to both URI
and local files, and hope the entire rest of the world has enough sense to follow me.
Upvotes: 0
Reputation: 1
In my experience it is called a query string whenever it is instructing action on the website. Code is frequently written to address the query string, which would prompt customized results on the page.
Otherwise, I agree it would be called a file name, if the path was referencing a file.
Upvotes: 0
Reputation: 2875
protocol://server.domain/path?query
The path element (and it appears there is no 'defacto' definition) in my mind is the path to the resource on the server. No matter whether the resource is a file (blah.html) or a folder (/path/) it still instructs the server to use the path to find the resource.
Now there appears to be another definition at good/bad ol' Wikipedia here which states that it is usually "http://server/path/program?query_string" where the end resource is defined as 'program' but I think this is incorrect (is a folder a program?)
So.. perhaps its should be
protocol://server.domain/path[/resource.*]?query
? /../../ I traverse...
Upvotes: 6
Reputation: 858
If URL is like /path/to/file.html or example.com/path/to/something.php?param=foo
then I think we can call it filename as mentioned at http://httpd.apache.org/docs/2.2/mod/directive-dict.html
Upvotes: 3