In your particular example, with those exact URIs, both will resolve to the same URI, but only because of the specific circumstances of your example. In general, the two are not equivalent.
./emelf.jpg
is a relative reference, more precisely a relative-path reference with a path consisting of two path segments, .
and emelf.jpg
.
emelf.jpg
is also a relative-path reference with a path consisting of one path segment, emelf.jpg
.
If we follow the relative resolution algorithm, we end up with the same absolute target URI for both examples, because of the remove dot segments sub-algorithm, in particular step 2.A. of sub-section 5.2.4 of RFC 3986:
If the input buffer begins with a prefix of "../
" or "./
", then remove that prefix from the input buffer
However, if the last path segment in the example could be any generic path segment, containing any legal URI character, then it is not always guaranteed that foo
and ./foo
are equivalent. Specifically, if the path segment contains a colon :
, then the two examples are interpreted differently:
./a:b
is a relative reference, more precisely a relative-path reference with a path consisting of two path segments, .
and a:b
. (In other words, it is interpreted the same as in the original example.)
- In
a:b
, a
is interpreted as a scheme, and b
as the path.
See the ultimate paragraph of section 4.2 of RFC 3986:
A path segment that contains a colon character (e.g., "this:that
") cannot be used as the first segment of a relative-path reference, as it would be mistaken for a scheme name. Such a segment must be preceded by a dot-segment (e.g., "./this:that
") to make a relative-path reference.
Adding a dot-segment anywhere in a path is always a no-op, but if you remove one, you may change how the URI is parsed. So, if you assemble paths from segments from different sources, and you don't know whether those segments may contain colons, you either need to check whether or not the situation shown above applies and slap an additional dot-segment on the front, or you simply always slap a dot-segment on the front, knowing that it is guaranteed to work.
Note: everything I wrote here applies to IRIs as well. IRIs mainly change the allowed characters, but not the parsing or interpretation.