Configure a default domain for not existing subdomains

internia

New member
Joined
Feb 7, 2009
Messages
2
Hello all, I need to access my domain from several subdomains, just pointing to the same page. This page will do something with the subdomain name.

For example, my domain is mydomain.com and I need that any subdomain as subdomain.mydomain.com acts equal as mydomain.com

As I have several subdomains to use, I don't want to configure each one in DNS Administration, but set a rule that accepts any subdomain.mydomain.com

I have used this feature in other control panels, but I don't know how to do it under Direct Admin.

Please help!
Thanks
 
Yes, I see, I have searched more information about wildcard subdomain, and now I've got the solution. I didn't know that wildcards are allowed in DNS Administration.

So I just added a CNAME register as:

*.mydomain.com CNAME mydomain.com

It works, now I've got to configure Apache to setup a virtual host. This is done by editing httpd.conf configuration file and writing:

#
# Your VirtualHosts section
#

NameVirtualHost 1.2.3.4


##
# this one accepts any subdomain
##
<VirtualHost 111.22.33.55>
DocumentRoot /www/
ServerName www.mydomain.com
ServerAlias *.mydomain.com
</VirtualHost>



Thank you!!
 
I do not have any VirtualHosts section in /etc/httpd/conf/httpd.conf

I have one in /etc/httpd/conf/extra/httpd-vhosts.conf

I have this :
Code:
<VirtualHost IP:80>
    ServerAdmin webmaster@localhost
    AliasMatch ^/~([^/]+)(/.*)* /home/$1/public_html$2
    DocumentRoot /var/www/html
    ServerName localhost
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    CustomLog /var/log/httpd/homedir.log homedir
</VirtualHost>

<VirtualHost IP:443>
    ServerAdmin webmaster@localhost
    AliasMatch ^/~([^/]+)(/.*)* "/home/$1/public_html$2"
    DocumentRoot /var/www/html
    ServerName localhost
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    CustomLog /var/log/httpd/homedir.log homedir

    SSLEngine on
    SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
</VirtualHost>

Do I paste your code just after ?
Code:
<VirtualHost IP>
DocumentRoot /www/
ServerName www.mydomain.com
ServerAlias *.mydomain.com
</VirtualHost>
Why DocumentRoot /www/ ?
Files are in home/member/domains/name_domain/virtual_subdomain/

Thanks for your help
 
I do not have any VirtualHosts section in /etc/httpd/conf/httpd.conf

I have one in /etc/httpd/conf/extra/httpd-vhosts.conf

Thanks for your help

You need to do this in DA under "Custom HTTPD Configurations"
 
Back
Top