Forum Moderators: open
I am still trying to find the best bulletproof way to deal with relative adressing within all links of a website. It seems no option I am trying out is at all functional:
Does anybody has a bulletproof way to do this?
Thanks!
Benni
I duplicate the file, then find '../' and replace with '../../'.
If I make any large scale changes to my main includes it merely takes me a moment to fix includes2.php and includes3.php.
I am now wary about relative links however because I've had some major f-tard requests from various bots that don't understand the concept of looking for a file in it's own folder. Files belonging to say a 1st level subfolder called "bob" will be requested from the root path. This is of course the bot's fault for not understanding relative links. It's just a total pain in my ass if I go out to slay dragons and 404s which I do every now and then. Ok just 404s... ;-)
You can use /dir1/dir2/page.html. The first slash represents the root dir. The problem with this is if you change where your site is located in relation to the root dir all the links will be no good.
However if your pages aren't in your root dir but you know the path just put /pathtomydir/dir1/dir2/page.html
If you're looking for the root in php you can use <? $_SERVER['DOCUMENT_ROOT'].'/dir1/dir2/page.html'?>