How do link inside other folders?

hey all,
i wanna know how to link a page if its another folder. i know it can be

<a href="home.php">Home</a>

which means its in root dir.
1.what if there r folder namely about and in about folder i have a index page. how do i give its link to that?
2. what if i have a incldues folder and i have giving links of other folder like i have menu in my includes folder and i have folders made out like about us and i wanna pull about us index page from about folder. how do i do that? i hope my question isn’t confusing

No, it means that it’s in the same directory as the page that contains the link.

That depends on where the ‘about’ folder is relative to the page that contains the link. If it’s a subdirectory,

<a href="about/index.php">About</a>

If it’s in a parallel directory.

<a href="../about/index.php">About</a>

In general,

<a href="/about/index.php">About</a>

Use a root-relative link:

<a href="/about/index.php">About</a>

It is! :wink:

If I am linking to the index.php file in the /about/ folder, I prefer to do this:


<a href="/about/">About</a>

That way, you don’t see “index.php” in the address bar.

As for includes, if you have something like menu.php in your /includes/ folder, link to it like this from any page:

<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/menu.php"; ?>

If you start the href with a / then it always starts from the root directory,

  • <a href=“/home.php”>[]<a href=“/folder/help.php”>[]<a href=“/folder/subfolder/page.php”>[*]<a href=“/otherfolder/file.php”>

This means that you can use the same link from anywhere on your site and it will always point to the same place.

If you don’t start the href with a / then it is relative to the file you are linking from. To go up a folder level, use …/
So, if you are in /folder/index.php, to link to each of the files above using a relative format, you would use

[list]
[]<a href=“…/home.php”> (up one level)
[
]<a href=“help.php”> (already in the right folder)
[]<a href=“subfolder/page.php”> (go into a subfolder)
[
]<a href=“…/otherfolder/file.php”> (up one level and then into a different folder)[/list]