# Ubuntu – How to redirect subdomains without specify the domain

dnsUbuntu

Is there a way to redirect all my subdomains without specify the domain, I mean for example:

when I write www it should resolve to www.mydomain.com or if I write ftp it should redirect to ftp.mydomain.com

I know I could write wildcards in the hosts file but I'm not sure how to write something where the wildcard take the subdomain and concatenate it with mydomain.com