How to set relative path to current folder?
Just dot is working. The doctype makes a difference however as sometimes the ./ is fine as well.
<a href=".">Link to this folder</a>
For anyone who has found this thread, addressing relative paths has always created arguments over what is correct or not.
Depending on where you use the path to be addressed, it will depend on how you address the path.
Generally :
.
and ./
do the same thing, however you wouldn't use .
with a file name. Otherwise you will have the browser requesting .filename.ext
as a file from the server. The proper method would be ./filename.ext
.
../
addresses the path up one level from the current folder. If you were in the path /cheese/crackers/yummy.html
, and your link code asked for ../butter/spread.html
in the document yummy.html
, then you would be addressing the path /cheese/butter/spread.html
, as far as the server was concerned.
/
will always address the root of the site.