Page 1 of 1
Variable in Document Root?
Posted: Sat May 24, 2008 6:04 am
by spacebiscuit
Hi,
I am setting up a virtual host within Apache as follows:
DocumentRoot "c:/Apache2/htdocs/mysite/index.php?data=1"
When I open the domain in my browser it does open the correct index.php page but I cannot read the variable data. Is what I am attempting possible?
Thanks in advance,
Rob.
Re: Variable in Document Root?
Posted: Sat May 24, 2008 6:15 am
by VladSun

You can't use DocumentRoot for such purposes.
DocumentRoot must be a valid path (i.e. directory, not a file).
Also, index.php is viewed not because of the DocumentRoot value, but because your DirectoryIndex directive is set so.
Re: Variable in Document Root?
Posted: Sat May 24, 2008 6:26 am
by spacebiscuit
Hmm, interesting.
This is my directory index line:
DirectoryIndex index.php index.html index.htm index.html.var
If I set the Documentroot as follows:
DocumentRoot "d:/Apache2/htdocs/mysite/home.php"
I get page canot be displayed unless I place a file named home.php in the root, which implies it does look for the named file and not just the directory.
Regarding the variable, I have found another method. I am using
...to check for the domain name and i'm then setting the variable accordingly.
Thanks,
Rob.
Re: Variable in Document Root?
Posted: Sat May 24, 2008 6:30 am
by VladSun
http://httpd.apache.org/docs/2.0/mod/co ... cumentroot
Description: Directory that forms the main document tree visible from the web
Syntax: DocumentRoot directory-path