views:

60

answers:

4

If you think they are not, please give an example for a string that can be called "URL" and not "path" and one that can be called "path" and not "URL".

+4  A: 

URL: http://stackoverflow.com/questions/3491674/are-the-terms-url-and-path-interchangeable
Path: /questions/3491674/are-the-terms-url-and-path-interchangeable


Schema: http
Host: stackoverflow.com

They're all different parts of the URL, they're not interchangeable.

deceze
But the second can also be called a relative URL, can it not?
Emanuil
A little cryptic, but i like it :) @Emanuil: a **path** will always need context to make sense (whether it is explicit or implied (as in conversation)). A URL shouldn't need that surrounding context. IOW: "path" is a term that has become used to mean part or whole of a URL or URI.
slugster
@Emanuil No, a relative URL would be `../../3491708/who-can-tell-me-about-the-chi-camo-blue-hair-straightener`.
deceze
@deceze: I don't understand. Why can't your example path be called a relative URL to this article? If you want to refer to this article from the index of SO, wouldn't you use exactly that relative URL?
Emanuil
@Emanuil A relative URL usually doesn't start with a `/`, that indicates an absolute path. A relative URL is relative to the current page, so the full URL would be `http://stackoverflow.com/questions/3491674/are-the-terms-url-and-path-interchangeable/questions/3491674/are-the-terms-url-and-path-interchangeable`, as seen from here.
deceze
What if the string looks like "C:\folder\subfolder\"? Is that a path or a URL?
Emanuil
A path can be a relative URI *reference*, though it's not the only possibility. And in the context of URIs, "C:\folder\subfolder\" is nonsense, though "file:///c|/folder/subfolder" is a URI and "/folder/subfolder" is its path.
Jon Hanna
@Douglas, also there are other relative URI references, which contain more than a path, such as ./?a=b and ://example.net/ really path is only useful to think about as part of a URI. That a URI ref can be a path is just one, not particularly important, case.
Jon Hanna
@Jon: True, I forgot about them, removed spurious comment.
Douglas
+1  A: 

URL is mostly a "web specific term", but path can be used in a lot of different contexts, filesystem path, XML [x]path, etc.

Cedric H.
+3  A: 

Getting if from the source: RFC 1738

An HTTP URL takes the form:

    http://<host>:<port>/<path>?<searchpart>
Douglas
That's interesting.
Emanuil
+2  A: 

A URI (including URLs though the distinction is irrelevant in most cases, and URLs are always URIs so mostly we just talk about URIs these days) is a globally-unique identifier of a resource.

E.g. http://example.net/foo/bar?a=b

A path is part of the URI, in the above example the path is /foo/bar

A URI reference is a means to textually communicate a URI. It can be absolute, in which case it is the same as the URI, and hence it will resolve to the same URI in any context. It can be an absolute-path, like /foo/bar?a=b in which case it will resolve to the same URI in any context sharing the same scheme, host and port. It can be relative such as ../bar?a=b and it can be scheme-relative such as ://example.net/foo/bar?a=b which resolves to the example URI above from any HTTP base URI, but not if the base URI is HTTPS or another scheme.

Jon Hanna