My Web Adventures

A blog for hackers by a dinosaur hacker.

URL Magic

I just wanted to check if I can see my blog without a Web Server.

This is what I got when I clicked on the index.html:

When I checked the source I found out that all the links were as:


So we need a short cheatsheet for URLs in Web pages:

Absolute URLs:

Absolute URLs have the format:


where the protocol can be:

  • http
  • https
  • ftp
  • file
  • git

Relative URLs:

Relative URLs have a number of formats:



In the first three cases everything is relative to referring page.

filename.html should be in the same directory with the referring page.

directory/filename.html filename.html should be in the directoryname directory which is in the referring page’s directory.

../ is for one directory up from referring page’s directory

When we have / at the beginning of directoryname, we are refering to current root of the Web Server. This relative path is actually relative to root of the server, not relative to referring page.

Finally, when our URL ends with /, Web Servers actually try to fetch the default page (which is normally index.html).