In your web programming you can either use relative or absolute paths to, say, pictures and other items you want to make accessible to the public.
Relative path: The root of your path is assumed to be / regardless of location. An address will look like: /images/mypic.jpg. Easy to maintain and code is trans-web portable. You can also address items relative to your current subdirectory. If, for instance, your index.html resides in the /example/ directory, you can address the /images/ folder like this: ../images/mypic.jpg
Absolute path: The root of your pat is your (or any other, for that matter) domain that then contain the file structure. This means that you prefix every (relative) address with your domain name. An address will look like: http://www.mydomain.com/images/mypic.jpg
Personally, I try avoiding at least the extreme version of relative addressing in my private webs, as they may turn up confusing or even non-functional. I therefore take the extra time to make sure all of my paths are fully absolute. Boring to enter, but 100% foolproof. Foolproof works well for me. Very well, in fact…
No Comments