Relative URLs
./images/profile.png
Relative URLs contain no protocols or domain information. This is convenient because they are shorter, but can only reference files in the same path. If I am the owner of www.example.com and am embedding “profile.png” on my About page, I can do so relatively with “./images/profile.png” as long as the images folder is in the same path as my page. I do not need an absolute URL.
The “.” is a path component stating that we need to remain in the current level of our directory hierarchy. Effectively, it says “to find this file, begin here and then head down inside the images folder, where you’ll find profile.png.”
To continue our analogy, since I’m already inside the same building as “profile.png,” I only need its apartment number to find it.
This will be handy for you as you start to link to your own images within your repo.
development
- Previous
- Next