?
Solved

Virtual Subdomais with www

Posted on 2003-03-10
6
Medium Priority
?
220 Views
Last Modified: 2013-11-15
I have a domain www.example.com and I want to add a subdomain www.test.example.com.

It just works if I add it like test.example.com
What should I do to be able to make it work as www.test.example.com ?

I am using Virtual Domains in Apache.

Need your help!
Deco
0
Comment
Question by:Deco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
pjedmond earned 100 total points
ID: 8107227
OK - using the script below or similar....after thatall you need to do is ensure that the DNS is set up correctly.

i.e:

ping www.example.com
ping www.test.example.com
ping test.example.com

As long as the DNS resolves correctly, then the below (or similar) will give you what you want:)

--------------------------------------X8-------------

NameVirtualHost *:80   # Any port 80 connection on any interface is virtual host

# Virtual host www.example.com
<VirtualHost _default_:80>     # On default interface - assume one:)
DocumentRoot /var/www/html/www/
       Options ExecCGI
       ServerName www.example.com
       ScriptAlias /cgi-bin/ /var/www/cgi-bin/
</VirtualHost>

# Virtual host www.test.example.com
<VirtualHost _default_:80>
       DocumentRoot /var/www/html/test/
       ServerName www.test.example.com
</VirtualHost>

# Virtual host test.example.com
<VirtualHost _default_:80>
       DocumentRoot /var/www/html/test2/
       ServerName test.example.com
       DirectoryIndex index.htm
</VirtualHost>
--------------------------------------X8-------------

Hope that helps:)
0
 
LVL 1

Assisted Solution

by:PCBackup
PCBackup earned 100 total points
ID: 8123560
pjedmond is correct with the explanation of the virtual hosting setup in Apache, but I think the confusion here has to do with domains and the DNS setup for the named addresses within a domain.

I think it is important to point out that www.example.com is not a domain.  The domain is example.com instead.  So, www.example.com simply points to an address for that domain.  You can create any number of named addresses for your example.com domain with any number of prefixes.  You are only limited by how crazy you want to drive the visitor to the website entering in all those characters.  

Also, www.test.example.com is NOT a subdomain of www.example.com.  www.test.example.com IS a subdomain of test.example.com.  Just remember that web addressing starts at the right end of the address name and parses to the left to reach the actual address.

You might just want the second website address to be test.example.com.  There is nothing that says a website has to start with www to be valid.  This is just standard practice for the primary website of a domain.

Does that help explain things any clearer?

Gene
0
 

Author Comment

by:Deco
ID: 8127259
Another thing!
for each virtual domain I create, do i have to add it into DNS?
0
 
LVL 1

Expert Comment

by:PCBackup
ID: 8133720
That's how I do it.  It might be possible to create subdomains of your primary site in the web server setup, but I find it easiest to create a pointer to each website virtual domain.  If you're running your own DNS, it's really the easiest way to approach it.

Gene
0

Featured Post

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is an update and follow-up of my previous article:   Storage 101: common concepts in the IT enterprise storage This time, I expand on more frequently used storage concepts.
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question