I am writing some documentation and I have a little vocabulary problem:
http://www.example.com/en/public/img/logo.gif
is called an "absolute" url, right?../../public/img/logo.gif
is called a "relative" url, right?/en/public/img/logo.gif
?Is it also considered an "absolute url", although without the protocol and domain parts?
Or is it considered a relative url, but relative to the root of the domain?
I googled a bit and some people categorize this as absolute, and others as relative.
What should I call it? A "semi-absolute url"? Or "semi-relative"? Is there another word?
There are two types of URL: Absolute URL. Relative URL.
A relative URL is a URL that only includes the path. The path is everything that comes after the domain, including the directory and slug. Because relative URLs don't include the entire URL structure, it is assumed that when linking a relative URL, it uses the same protocol, subdomain and domain as the page it's on.
An absolute URL contains more information than a relative URL does. Relative URLs are more convenient because they are shorter and often more portable. However, you can use them only to reference links on the same server as the page that contains them.
relative hyperlinks. Relative links use the location of the map as a base and show the path to the document from there. Absolute links use the entire path name.
Here are the URL components:
http://www.example.com/en/public/img/logo.gif \__/ \_____________/\_____________________/ #1 #2 #3
A URL is called an absolute URL if it begins with the scheme and scheme specific part (here //
after http:
). Anything else is a relative URL.
A URL path is called an absolute URL path if it begins with a /
. Any other URL path is called a relative URL path.
Thus:
http://www.example.com/en/public/img/logo.gif
is a absolute URL,../../public/img/logo.gif
is a relative URL with a relative URL path and/en/public/img/logo.gif
is a relative URL with an absolute URL path.Note: The current definition of URI (RFC 3986) is different from the old URL definition (RFC 1738 and RFC 1808).
The three examples with URI terms:
http://www.example.com/en/public/img/logo.gif
is a URI,../../public/img/logo.gif
is a relative reference with just a relative path and/en/public/img/logo.gif
is a relative reference with just an absolute path.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With