I have a domain ie test.example.com.
I set the hostname of my server to this by uisng:
I then add a Virtual host in /etc/httpd/conf/httpd.conf
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/html/ </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/html/mydir ServerName test.example.com ServerAlias www.test.example.com </VirtualHost>
I then restart the Httpd service. If I try to access test.example.com I get index.php in /var/www/html and not the specified folder. If I change the hostname to something other than this and then restart httpd, the virtual host works as expected, so I can only assume that when there is an incoming connection to the hostname, apache strips the url.
In php when printing
I get /. Can anyone tell me how to can overcome the issue or should I keep the hostname set as something else? I have a backup script which uses the hostname as a directory name so I can organise the backups nicely, this is the main reason I have changed the hostname in the first place.