Forum Moderators: phranque

Message Too Old, No Replies

Can subdomains be created serverside or created as an A record?

using Apache 1.3

         

Calzinger

1:51 am on Aug 24, 2004 (gmt 0)



I am relatively new to Apache so I apologize if my questions seem noobish or what not.

I am curious if it's possible to create a subdomain or something that will act as one in Apache. For instance, CPanel creates subdomains without touching the domain.

Currently, I create A record subdomains and point them to my server IP. Then I setup the virtual host in apache to recognize that subdomain and redirect it to its relative folder.

I was hoping for something a little more organized or at least easier so that apache can look for any sort of "subdomain" part to the entered url, then redirect to the specified page. Going to my domain manager and creating A records each time seems to be the improper way, but if that's the only way, then that is the only way. I did read somewhere that when you create a folder in your document_root, it automatically redirects to that folder when you enter the folder name as a subdomain. I do think that that was a feature specifically for that web hosting company.

If this question has been answered elsewhere, a link would be helpful as I was unable to find anything after searching.
Any help is greatly appreciated!

Thanks.
Calzinger.

dmorison

6:11 pm on Aug 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you need are "Automatic Virtual Hosts", supported in Apache since 1.3.7.

See:

[httpd.apache.org...]

For example, if you have the following in your config..

VirtualDocumentRoot /var/www/virtualroot/%0

..then, you can serve www.example.com simply by uploading a website to:

/var/www/virtualroot/www.example.com/

dito any other host, all without any re-configuration of your server. Combine this with wildcard DNS and I think you have what you're looking for...