Most URLs are pretty basic. However, using them for something a little more complex gets confusing. The HTML and URLs page on w3.org is the definitive reference and actually unusually easy to understand for a standards document.
I've been converting pages from WordPress to Ghost and have found a curiosity. Ghost page URLs have a trailing slash, which forces the web server to look for a page like index.html, index.htm, index.php, ... in the same location. This is fine, but what if I want to reference another page on the same site? Normally the construct:
is the correct relative URL. But if the base isn't a page, this does not work. For instance, if the page URL is:
Using a relative URL to get to another page:
Results in this URL:
Clearly wrong. To correct this, let's use a little tree traversal... go up one node then refer to the node next to it. Therefore using:
Results in the URL:
Which resolves to the correct URL: