You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ota mares <ot...@googlemail.com> on 2008/06/24 15:19:13 UTC

[users@httpd] Apache/2.2.9, Windows XP/Vista, Relative paths do work, but why?

Hi,

i am currently toying around with my own local WAMP installation and
found out that though everyone tells me relative directory and alias
paths do not work, they DO work!
Unfortunately i am unable to find any information on that behaviour so
that's why i am turning to the mailing list :-)

The whole project can be downloaded from the following URI and i
recommend to take a look at it for easier understanding.
http://ohne-ziel.de/projects/LDE/LDE-0.6.0.rar


The functionality is pretty simple, apache-start.bat calls the
httpd.exe with the -d and -c config parameters.
The serverroot will be set to the current working directory, the most
upper directory of the whole project, so if you assume the whole
project is in "C:/LDE-0.6.0/" the serverrot gets set to
"C:/LDE-0.6.0/" ;)

All paths are setup to be relative to that directory. And here is the
clue, even relative directory directives work. Check out line 193 to
198 of the apache.conf in the "configuration/" dir. It clearly allows
access to the default documentroot and shows the directory listing
when you visit http://localhost.

<Directory "srv/www/localhost/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Another validation is that icons in the directory listings work, look
at the autoindex.conf in the "configuration/apache/" directory. All
paths are relative even the alias directive.

The last testcase would be to call http://localhost/~phptest/ which
shows up the phpinfo. All directory calls with a tilde will be routed
to another docroot via an aliasmatch directive to avoid host file
editing.

I tested it on two machines Windows XP and Vista and it allways worked.

If you download my test project you can easily confirm that everything
works as i wrote here. To start the server, simply unpack it anywhere
you want and doubleclicke the apache-start.bat.

I assume that the paths get appended to the serverroot but the
documentation explicitly says that directory directives have to be
absolute?
Please, could anyone explain then to me why it works or if i made an
error somewhere or simply i am just plain stupid to read the docs? :-)

Before anyone misunderstands me, i am glad it works that way, this
behaviours saves me to parse and create tmp config files, i just would
like to know why!

Thanks & Regards
Ota

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Apache/2.2.9, Windows XP/Vista, Relative paths do work, but why?

Posted by ota mares <ot...@googlemail.com>.
I found out that all paths except the directory directives are
relative to the provided document root.

The directory directive paths are all relative to the current
execution path which is set by the bat file to the same directory as
where the bat is stored.
The START CMD Command (http://www.ss64.com/nt/start.html) provides the
option /D which allows you to change the execution dir to a custom
path, so i was able to confirm my theory by changing it to random
paths and editing the directory directives to the correct relative
path.

It would be nice if someone who has more insight than me could confirm this?

On Tue, Jun 24, 2008 at 15:19, ota mares <ot...@googlemail.com> wrote:
> Hi,
>
> i am currently toying around with my own local WAMP installation and
> found out that though everyone tells me relative directory and alias
> paths do not work, they DO work!
> Unfortunately i am unable to find any information on that behaviour so
> that's why i am turning to the mailing list :-)
>
> The whole project can be downloaded from the following URI and i
> recommend to take a look at it for easier understanding.
> http://ohne-ziel.de/projects/LDE/LDE-0.6.0.rar
>
>
> The functionality is pretty simple, apache-start.bat calls the
> httpd.exe with the -d and -c config parameters.
> The serverroot will be set to the current working directory, the most
> upper directory of the whole project, so if you assume the whole
> project is in "C:/LDE-0.6.0/" the serverrot gets set to
> "C:/LDE-0.6.0/" ;)
>
> All paths are setup to be relative to that directory. And here is the
> clue, even relative directory directives work. Check out line 193 to
> 198 of the apache.conf in the "configuration/" dir. It clearly allows
> access to the default documentroot and shows the directory listing
> when you visit http://localhost.
>
> <Directory "srv/www/localhost/">
>    Options Indexes FollowSymLinks
>    AllowOverride All
>    Order allow,deny
>    Allow from all
> </Directory>
>
> Another validation is that icons in the directory listings work, look
> at the autoindex.conf in the "configuration/apache/" directory. All
> paths are relative even the alias directive.
>
> The last testcase would be to call http://localhost/~phptest/ which
> shows up the phpinfo. All directory calls with a tilde will be routed
> to another docroot via an aliasmatch directive to avoid host file
> editing.
>
> I tested it on two machines Windows XP and Vista and it allways worked.
>
> If you download my test project you can easily confirm that everything
> works as i wrote here. To start the server, simply unpack it anywhere
> you want and doubleclicke the apache-start.bat.
>
> I assume that the paths get appended to the serverroot but the
> documentation explicitly says that directory directives have to be
> absolute?
> Please, could anyone explain then to me why it works or if i made an
> error somewhere or simply i am just plain stupid to read the docs? :-)
>
> Before anyone misunderstands me, i am glad it works that way, this
> behaviours saves me to parse and create tmp config files, i just would
> like to know why!
>
> Thanks & Regards
> Ota
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org