How do you redirect naked domain to www

How do you redirect naked domain to www. Do I need to do it for a subdomain as well?