[thelist] apache alias, rewrite or something

Phil Turmel philip at turmel.org
Thu Jun 29 20:04:51 CDT 2006


Dan McCullough wrote:
> Trying to allow different domains share code, now I have the part
> where they can share the code, however they all need their own config
> file and so I am having difficultly with trying to get each domain to
> read the config file from their doc root.
>
> So what I have is and this is inside the VirtualHost directive.
>
> Alias / "/usr/share/app"
> Alias /usr/share/app/config.php "/home/site/domain.com/htdocs/config.php"
> or
> Alias config.php "/home/site/domain.com/htdocs/config.php"
>
> This doesnt look like the right way to go so not sure if a Rewrite
> Rule should be used or not.
Dan,

If this config file is being retrieved by an include() call within PHP,
nothing you do with apache will help. PHP includes are filesystem names,
and do not go back through apache for aliasing or rewriting.

If only one place in the app calls the config file, change the include
call like so:

include($_SERVER['DOCUMENT_ROOT'].'/config.php');

If the config file is called from numerous places, you could replace the
original config file in /usr/share/app with a stub that has the above
instruction.

HTH,

Phil



More information about the thelist mailing list