PDA

View Full Version : Wilcard sub domains where do I insert ServerAlias?



zaz! Interactiv
04-23-2010, 03:58 PM
I am tried to setup a wildcard subdomain through the normal way (httpd settings in admin panel) but only my wildcard subdomains would work and my actual subdomains would not. Where should I enter
ServerAlias *.|DOMAIN| into the code below to make both wildcard and normal subdomains work?


<VirtualHost 67.23.167.171:80>

ServerName www.ruddo.com
ServerAlias www.ruddo.com ruddo.com
ServerAdmin webmaster@ruddo.com
DocumentRoot /home/ruddocom/domains/ruddo.com/public_html
ScriptAlias /cgi-bin/ /home/ruddocom/domains/ruddo.com/public_html/cgi-bin/

UseCanonicalName OFF

SuexecUserGroup ruddocom ruddocom
CustomLog /var/log/httpd/domains/ruddo.com.bytes bytes
CustomLog /var/log/httpd/domains/ruddo.com.log combined
ErrorLog /var/log/httpd/domains/ruddo.com.error.log

<Directory /home/ruddocom/domains/ruddo.com/public_html>
Options +Includes -Indexes

php_admin_flag engine ON
<IfModule !mod_php6.c>
php_admin_flag safe_mode OFF
</IfModule>
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f ruddocom@ruddo.com'



</Directory>



</VirtualHost>


<VirtualHost 67.23.167.171:80>


ServerName www.directory.ruddo.com
ServerAlias www.directory.ruddo.com directory.ruddo.com
ServerAdmin webmaster@ruddo.com
DocumentRoot /home/ruddocom/domains/ruddo.com/public_html/directory
ScriptAlias /cgi-bin/ /home/ruddocom/domains/ruddo.com/public_html/directory/cgi-bin/

UseCanonicalName OFF

SuexecUserGroup ruddocom ruddocom
CustomLog /var/log/httpd/domains/ruddo.com.directory.bytes bytes
CustomLog /var/log/httpd/domains/ruddo.com.directory.log combined
ErrorLog /var/log/httpd/domains/ruddo.com.directory.error.log
<Directory /home/ruddocom/domains/ruddo.com/public_html/directory>
Options +Includes -Indexes

php_admin_flag engine ON
<IfModule !mod_php6.c>
php_admin_flag safe_mode OFF
</IfModule>
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f ruddocom@ruddo.com'

</Directory>

</VirtualHost>

ranz
04-23-2010, 05:17 PM
you would add:



ServerAlias www.ruddo.com ruddo.com *.ruddo.com


and then make sure you have the appropriate A Record in your DNS zone.

zaz! Interactiv
04-23-2010, 05:34 PM
you would add:



ServerAlias www.ruddo.com ruddo.com *.ruddo.com


and then make sure you have the appropriate A Record in your DNS zone.

I tried that already. Do I have to move the virtualhost for the subdomain above the one for the main domain?

ranz
04-23-2010, 05:44 PM
That allows for any "subdomain" on the main TLD to load the main website. Is that what you're after - or something else?

If you add a subdomain via the DA CP, you will notice that it adds it's own separate <VirtualHost> record for both :80 and :443 (SSL). If you want this level of control, perhaps you could try adding a fixed subdomain and edit that particular <VirtualHost> record to your liking.

Try this post:
http://www.directadmin.com/forum/showthread.php?t=2781

floyd
04-24-2010, 04:41 AM
I am tried to setup a wildcard subdomain through the normal way (httpd settings in admin panel) but only my wildcard subdomains would work and my actual subdomains would not.

That is the correct behavior. Wildcard means you want EVERY subdomain to go a certain place. You can't have it both ways.

I believe there are tricks to make it work but not reliably for a novice. You would have to maintain the configuration manually and not use DirectAdmin to do it.