Not to sure if this is a PHP question or an Apache question.
Ok here it is,
I have multiple sites set up on a “dev” server (wamp) on my machine like so: C:\wamp\www\siteone.com C:\wamp\www\sitetwo.com C:\wamp\www\sitethree.com ...
And in each of those sites is an “includes” directory where I store all my php data that I would like to link to ala $_SERVER['DOCUMENT_ROOT'].’/includes/filename.php’
However... I currently have to add the site directory into the path: ‘/siteone/includes/filename.php’. So when I move it over production, I will have to change every path name before I do so. And I don’t want to do that. There will be many of these!
So... My questions are: 1. Can I create an Alias to each one of these directories for all my sites on my “dev” server: Alias /includes /siteone.com/incudes ? 2. If so, will the call to &_SERVER[‘DOCUMENT_ROOT’] .’includes’; actually work when I am testing. 3. Will one Alias cancel out another one? Like if I am testing sitetwo.com and siteone.com is listed first in my alias, will that cause sitetwo.com not to work?
I am a long time web designer slowly turning web programmer (translation: n00b), so I am not sure as to what route to take. And if you have any suggestions as to how to approach this in a completely different way, please share.
By far the simplest and most sustainable method is to configure your server to support name-based virtual hosts, and then set the DocumentRoot for each domain as you desire.
The end result is that your dev server will be configured much more closely to your production environment, and that is almost always a very good thing.
Apache has a lot of info on setting up virtual hosts, and I commend it to you. That, plus defining the domains in the 'hosts' file on your own machine to point to 'localhost' will leave you with a development environment that is little different from production.