Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Will an Alias work for multiple test domains

3:38 pm on Mar 29, 2011 (gmt 0)

Full Member

5+ Year Member

joined:Mar 3, 2009
posts: 227
votes: 0

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:

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.
12:30 am on Apr 7, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0

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.

5:19 pm on Apr 7, 2011 (gmt 0)

Full Member

5+ Year Member

joined:Mar 3, 2009
posts: 227
votes: 0


Thank you very much! This works perfectly! I Googled a how-to on "name-based virtual host with lamp/wamp" and found a couple of great tutorials on this. Exactly what I needed!

Again.. Thank You. :)

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members