- Impact
- 6
In directories such as DMOZ how do they get the / on the end of there url like dmoz.com/arts/ how can only think of a why to do it throuh dmoz.php&var=arts
Last edited:
require_once "../(name of folder header is in)/header.php";
// the rest of your php comes here
<?php
// this is any php document that you are requiring header in
if ($_SERVER["PHP_SELF"] == (some dir)/header.php) {
$text = "../";
} elseif ($_SERVER["PHP_SELF"] == (some dir)/(some dir)/header.php) {
$text = "../../";
}
?>
<a href="<?php echo "$text";?>">link text</a>
i believe that they already are.cerebus said:Instead of messing with the PHP you could just make the links relative to the root of the domain, starting it with a slash (/)
Ie. href="/index.php" on http://www.abc.com/folder/file.php goes to abc.com/index.php
How did I forget to mention the almightly apache module mod_rewrite.adam_uk said:they do it with mod_rewrite
its an apache module that lets you use fake/virtual urls (and then it rewrites them
so you may have a script like
/blah.php?dir=sports§ion=f1&page=2
that url is pretty ugly so you can tidy it up and have this
/sports/f1/2
http://www.sitepoint.com/article/guide-url-rewriting/


