PDA

View Full Version : Relative urls from different subdirectories


pepsi_max2k
07-10-2007, 09:05 PM
Ok another menu related question... I'm coding a single menu bar, phping it into various documents in differing levels of subdirectories, some in ...co.uk/blog/, some in ...co.uk/crimea/pages/, ...co.uk/crimea/pages/info/, etc etc.

Using absolute urls would work fine wherever the page was, but that stops me being able to use multiple domain names for a single site, or at least until someone hits a link.

Problem is I'm not to sure if there's a way of using relative urls instead as the links will be the same regardless of what directory a page is in. eg, just using ../info/blah.html, will work fine if i'm in /page/somethingelse, but if i'm in /blog/wherever/ it won't work.

Only thing I can think of now is, hopefully, just adding ../../../../../../../ will take me to the root of the site from anywhere, ignoring any excess ../'s, then i can just add the path from the root after that. Or if there's a kinda way to use /public_html/crimea/pages/blah.html instead then that's great.

Any ideas what I should do? thanks.

oracleguy
07-10-2007, 10:25 PM
If you just do /<the path from the root you want> it should work. You don't have to do .../ all your way up to the top.

pepsi_max2k
07-10-2007, 10:59 PM
:rolleyes: cheers, always the simple stuff google fails me on :( :thumbsup: