[Xitami] how to configure alias
Simon McVittie
xitami@lists.xitami.org
Tue, 06 Nov 2001 15:56:28 +0000
> I'm testing things localy on my pc not on the host server and when I go
> insert an imasge from the image folder it goes back 3 levels as so
> <IMG SRC="../../../images/bevel_bg.jpg" BORDER="0" WIDTH="150" HEIGHT="40"
> ALIGN="bottom" ALT="">
> now al I want is to confige the alias to read any images from this folder on
> my c:drive
> is this correct if not can you give the correct configuration
> images=c:\images\ http://127.0.0.1/c:/images/.gif/.jpg./.png
If you're running Xitami on your PC, that *is* the host server. Your web
browser (Internet Explorer, Netscape, whatever) doesn't read from the disk
itself if you're testing your site through Xitami - all it knows about your
site is what Xitami tells it.
If you set an alias like
[Alias]
images=c:\images
then, for example, going to the URL http://127.0.0.1/images/bevel_bg.jpg
will get you the contents of the file 'c:\images\bevel_bg.jpg'. (* footnote)
In general, an alias like
[Alias]
aliased/server/path=c:\real\path\on\disk
will map the URL
http://127.0.0.1/aliased/server/path/somefolder/somefile.ext
to the real file
c:\real\path\on\disk\somefolder\somefile.ext
(I hope you can see where the the components of this path come from).
It sounds as though your HTML writing software is getting its relative
paths wrong, or making big assumptions about how your real disk filesystem
maps to the server's "virtual filesystem". If the current working directory
is '/cgi-bin', which it is for these scripts, your web browser *can't* go
up 3 levels, because as far as it can see there's only one level to go up
through (it goes up one level to '/', then can't see any further).
If you have an alias like the one above you can use an image with a tag like
<img src="../images/bevel.jpg" alt="">
which your web browser will expand to
http://127.0.0.1/cgi-bin/../images/bevel.jpg
then contract to
http://127.0.0.1/images/bevel.jpg
before it sends
the request.
It may be better to use an absolute path like
<img src="/images/bevel.jpg" alt=""> (this one is probably better),
which your web browser will expand to http://127.0.0.1/images/bevel.jpg
before it sends the request.
It's impossible to go up 3 levels because your browser doesn't know there's
anything above the root, so it won't send a request which goes above /; and
because, for security reasons, Xitami won't send files from outside the
webpages root, unless it's been told to do so by an alias. This is to
prevent arbitrary users doing things like sending a request for something
like http://127.0.0.1/../../windows/system/user.dat and getting half your
Registry.
*: Xitami assumes your 'images' directory contains the icons which come
with it (this isn't great design IMO, but that's how it works). If you want
directory listings to look right, you might need to copy the images from
c:\xitami\webpages\images (or wherever you have Xitami installed) into the
folder which will be accessible as http://127.0.0.1/images/ (e.g.
c:\images).