Tuesday, May 1, 2012

Wildcard DNS

Wildcard subdomains are useful when you wish to redirect all visitors to your main website regardless of what subdomain they access your website through.

 This is also useful when someone mistypes www for example and writes ww.yourdomain.com.

edit the DNS file or db file of domain and add the line as

vi /var/named/domainname.db

*.domain.com. 14400 IN A IP of server
www.*.domain.com. 14400 IN A IP of server

Edit the httpd.conf and add the line in virtual host of domain.
ServerAlias *.domain.com www.*.domain.com

/etc/init.d/httpd restart
/etc/init.d/named restart



No comments: