What is a relative path? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is a relative path?

18th Aug 2016, 6:55 PM
Eric Lenny
Eric Lenny - avatar
2 Answers
+ 2
absolute path: http://www.sitio.com/assets/css/file.css relative path: /assets/css/file.css (if you are in the root)
31st Aug 2016, 1:46 PM
Reynaldo Esparza Garcia
Reynaldo Esparza Garcia - avatar
0
a relative path is a path relative to the folder it is called from, for example say A.PHP and B.PHP are .PHP files in the same folder, if A links to B the path is just the filename B.PHP. If A was in a folder that contains a folder 'X', and B was in that folder, the path from A to B would then be X/B.PHP : first the folder, then the file name. These paths are relative in that they only work in that one folder, anywhere else 'X/B.PHP' wouldn't be a valid path.
21st Aug 2016, 1:44 PM
Andres Mar