0

Probably not the best title, but I am not sure how to describe in a few words.

Alright; I wish to have an "overall" domain to view my websites in browser. Like I would like to have, eg. testdomain.com to work as my "overall" domain, so I could access the sites I'm hosting like "mysite.com" - on "mysite.com.testdomain.com" (or somewhat near).

I need to locate the corresponding website, based on that subdomain, and serve it to the browser. Much like i can FTP into "testdomain.com" with the user "mysite.com" to access the FTP account.

Is this possbible and how can it be done? I hope I meane this clear.

Thank you!

janhartmann
  • 131
  • 1
  • 8

2 Answers2

1

It's a matter of configuring DNS correctly, combined with configuring virtual hosts on your web server. If you have the ability to manage your site's DNS entries and your web server configuration, this is easy enough to do.

Geoff Fritz
  • 1,727
  • 9
  • 11
1

You might be interested in the VirtualDocumentRoot directive if you're using apache: http://httpd.apache.org/docs/2.0/vhosts/mass.html. It would allow you to use one configuration for many sites, e.g.:

<VirtualHost *>
    ServerName testsite.com
    VirtualDocumentRoot /www/%0/docs
</VirtualHost>

Now if you enter mysite.com.testsite.com in the browser it would try to load the files from /www/mysite.com.testsite.com/docs etc.

Configuring DNS for that is much easier. You just have to create a DNS record for *.testsite.com to point to your server`s IP address.

Tomas Markauskas
  • 402
  • 1
  • 3
  • 7
  • That's cool! I always like to explicitly name everything (I don't like surprises), so this option was unknown to me. I'll have to jot this one down for future reference. I can see where it might come in handy. – Geoff Fritz Dec 02 '09 at 18:09
  • I am hosting multiple websites on a IP address (and using IIS) - is this still possible? I need to bind the subdomain-host name to the "mysite.com" files. So confusing! :P – janhartmann Dec 03 '09 at 07:20