What is ./ in HTML?

Hi All,

Simple HTML question.

What does  ./  do in HTML

-i.e.


<a href="./index.html">index</a>
LVL 2
detox1978Asked:
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 ;)
0
 
gudii9Commented:
it basically maps URLs to Filesystem locations ( references based on root, user directory etc)
0
 
detox1978Author Commented:
That's what i thought, but i'm using a PHP script and it returns file not found?


Any ideas why?
0
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?
0
 
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.
0
 
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>

0
 
qwerty021600Commented:
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.
0
 
detox1978Author Commented:
thanks,
0
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.