What is ./ in HTML?

Hi All,

Simple HTML question.

What does  ./  do in HTML


<a href="./index.html">index</a>
Who is Participating?
DubouxConnect With a Mentor Commented:
In easy language:

./ stands for the current folder the page you're looking at in your browser is also in.
../ is a folder above it.
../../ is the folder above that one..

for example, the script/page you're linking in, is in this folder:
folder1 / folder2 / folder3 / your_page.html
./ = folder1 / folder2 / folder3 /
../ = folder1 / folder2 /
../../ = folder1 /

it's tidy to use ./
but defenately not necessary ;)
it basically maps URLs to Filesystem locations ( references based on root, user directory etc)
detox1978Author Commented:
That's what i thought, but i'm using a PHP script and it returns file not found?

Any ideas why?
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

detox1978Author Commented:
Sorry i should have said, it stays with the folder instead of going to the root....

any ideas why?
GarthSnyderConnect With a Mentor Commented:
In short, the "./" does nothing.

This is really a URL question, not an HTML question, and URLs follow UNIX path semantics. In that system "." is the name of the current directory and / is just the path separator. So "./index.html" is completely equivalent to "index.html".

If the file isn't found, make sure the current HTML BASE is really pointing at the parent URL of that index.html file.
hankknightConnect With a Mentor Commented:
"./index.html" is equivalent to "index.html" however ./ is not useless and redundant.  Use ./ when you want to go to the index of the current directory.

For example, this could NOT be done any other way than with ./:
    <a href="./">Index</a>

See if you want to refer to an image which is separate folder. For Example
You have this folder structure :
One folder which contain all the images and CSS.

So if in a class in CSS, you refer to any background image. you'll give the path ./ for the image as the CSS and image are in the same folder.
detox1978Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.