HTTP from Home folders

Stefan Bruda yellowdog-general@lists.terrasoftsolutions.com
Sun Nov 23 12:00:06 2003


Hi.

At 20:43 -0800 on 2003-11-22 Katsu Tanda wrote:
 >
 > so I have the code img src="/img.jpg" it links that to
 > mydomain.com/img.jpg rather than the one in the user folder. So i
 > have to link it like src="/~user/img.jpg" to get it to work
 > right. I don't really want my users to have to link like that cause
 > its kinda inconveinent.

Oh, sorry, I misunderstood your question then.  UserDir maps files
such as ~user/foo/bar.html, in the sense that ~user should be there in
order for the mapping to take place.  If you request /img.jpg then as
far as I know there is nothing in the HTTP standard to map this
according to... to what, to the page that contains the link?  HTTP is
a stateless protocol so it cannot know the page that produced the
link.  The browsers do map relative paths correctly, but as far as I
know nobody maps absolute paths unless you create a virtual server for
each and every user.

You should think about the problem then in userspace rather than on
the HTTP side.  For instance, you can instruct your users to use
relative paths, i.e., to write src="img.jpg" instead of
src="/img.jpg".  These are interpreted by browsers and will produce
HTTP queries in which the current directory is expanded to the actual
full URL.  There is also a BASE HTML tag you may be interested in
using.

I might be wrong though, I am not that familiar with HTTP and the
Apache extensions and whatnot.

 > oh, i use the default config,
 > UserDir public_html
 > 
 > maybe i should do
 > UserDir /home/*/public_html
 > ?

It shopuld make no difference, the problem you mention is different.

Stefan

-- 
If it was so, it might be; and if it were so, it would be; but as
it isn't, it ain't. That's logic.
    --Lewis Carroll, Through the Looking-Glass