I would estimate probably 99.9999% of the *nix servers -- I can't speak for the Win
servers -- out there support the $SERVER['SERVERNAME']; variable. I can't imagine
why a sysadmin would disable it.
Me neither... Still it has been good to know about these gotchas though. Props.
Interesting approach, thanks for your response. Your point about about sending less
chars to the client is with merit, especially for large documents where the extra code
that an absolute URL would necessitate could add up. Gotta shave off bytes and kb's
wherever possible right?.
I'm a bit confused though about the url that would be generated and the "portability"
henceforth of each page/article so hoping you can elaborate on your suggestion a bit.
Unless I've got it totally confused by referencing resources using paths like:
would this not create URLs that are relative to the doc that references the resource?
This will work on a "flat" site but on one with subdirectories, where the resources are
kept in a central place, would this not create broken links? It would mean that I would
need to change the URL path for each of the docs in the subdirectories so that the links
are relative to the doc/article/page in question. I could just have this twisted!
stylesheets etc is mainly for maintenance and portability reasons. I am also going
to implement a data feed of sorts on most pages that will pull article snippets from
various locations on the site and I'm thinking by using relative paths for images and
actual links (<a href=""></a> to send visitors to those pages/articles) could
create broken links.
I would by all means rather use relative URL paths for stuff like imgs, js etc for ease
of implementation but since my knowledge of php is near non-existent at this current
time, I'm not sure how I would go about achieving this easily without some serious
self education first. If you know of a resource or can point me towards one, I'd be
grateful. Many thanks.