[Techtalk] directory handling with apache server
johnc+linuxchix at kirriwa.net
Mon Oct 27 13:41:25 EST 2003
On Sun, Oct 26, 2003 at 07:54:26 -0500, Brenda Bell wrote:
> Quoting John Clarke <johnc+linuxchix at kirriwa.net>:
> > it's not bogus, and i explained why in my previous post. if you get a
> > directory url without the trailing slash, apache will send back a
> > permanent redirect to the url with a trailing slash. the browser will
> > then fetch the new url.
> That's it. That's what I remember reading. FYI, "bogus" only to me...
> just one of those technical quirks that doesn't make since IMO. But I'm
i'll try to explain it so that it makes sense, but tell me to shut up
if you don't want to know. i won't be offended :-)
web pages often contain relative links, where the path to the linked
page is relative to the directory containing the current page (much
like you'd use a relative path when changing directories). the browser
has to turn this into an absolute url to pass to the server, so it
needs to know whether the url is a file or a directory. it does this by
treating anything ending in a slash as a directory, and everything else
as a file.
when building an absolute url from a relative one, the browser removes
the file part of the current page (i.e. everything after the last
slash) and appends the relative url. i don't know whether it strips
directories when it finds '../' in the relative path or whether it
relies on the server to do that, but it doesn't matter for the sake of
this discussion (apache does the right thing with '../' in the url
so if you give the browser a directory url without a trailing slash,
it'll think the path is to a file and so any relative urls won't work.
that's why the server sends a redirection to the url with a trailing
slash, and hence why it's more efficient to add the trailing slash
> not an HTTP/app server expert
i wouldn't call myself an expert either. i just know enough to be
> so please take it in context.
i'm sorry, i misunderstood what you meant by bogus. i was only trying
to explain it so that you might understand why it's necessary. no
whois !JC774-AU at whois.aunic.net
GPG key id: 0xD59C360F
More information about the Techtalk