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.
Variable in Document Root?
Moderator: General Moderators
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: Variable in Document Root?
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.
There are 10 types of people in this world, those who understand binary and those who don't
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: Variable in Document Root?
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.
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
Code: Select all
$_SERVER['HTTP_HOST']Thanks,
Rob.
Re: Variable in Document Root?
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
There are 10 types of people in this world, those who understand binary and those who don't