homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Will an Alias work for multiple test domains
CSS_Kidd




msg:4289044
 3:38 pm on Mar 29, 2011 (gmt 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:
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.

 

jdMorgan




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

Jim

CSS_Kidd




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

@jdMorgan,

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. :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved