homepage Welcome to WebmasterWorld Guest from 50.17.7.84
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Configuring sub-domains
How to configure a sub-domain to also work with www
kidd




msg:915692
 8:16 pm on Sep 30, 2002 (gmt 0)

Hello...

Im having a problem because I dont know how can I configure my server so all the sub-domains work with www also...

Lets say I have "test.misite.com" I want the sub-domain to also work with "www.test.misite.com"

Im working on a Linux OS with Apache version 1.3.24

Thanks...

 

dingman




msg:915693
 12:02 am on Oct 1, 2002 (gmt 0)

Two issues here. First is DNS, and second is virtual hosts.

www.test.mysite.com needs to point to the same ip as test.mysite.com does. How you accomplish this depends on whether you run your own name server, if so which one it is, and if not how your ISP allows you do modify DNS data.

Then you need to configure your virtual hosts on Apache. How you do this is quite variable depending on what you are doing. If you have a different IP for each distinct site you are hosting, then do something like:

<VirtualHost 192.168.0.2>
ServerAdmin webmaster@mysite.com
DocumentRoot /dir/with/mysite/content/
ServerName www.mysite.com
</VirtualHost>

<VirtualHost 192.168.0.3>
ServerAdmin webmaster@test.mysite.com
DocumentRoot /dir/with/test.mysite/content/
ServerName www.test.mysite.com
</VirtualHost>

This will make Apache serve different content based on which IP you connect on. Apache won't care if you hit that IP by calling it test.mysite.com or www.test.mysite.com.

If you don't have multiple IPs at your disposal, you can use NameVirtualHost. I'm not sure if you have to define multiple NameVirtualHost sections, one for each name, or whether you can list multiple names. I don't have any NameVirtualHost sections in my own config right now, because they are incompatible with SSL, and all my domains have SSL support.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
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