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:

http:thepage.html

is the correct relative URL. But if the base isn't a page, this does not work. For instance, if the page URL is:

http://192.168.11.11/a-page/

Using a relative URL to get to another page:

http:another-page/

Results in this URL:

http://192.168.11.11/a-page/another-page/

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:

http:../another-page

Results in the URL:

http://192.168.11.11/a-page/../another-page/

Which resolves to the correct URL:

http://192.168.11.11/another-page/