Adding www. to Domain

Thank you for this - I have read through both options, but just wondered, why could I not just use a simple 301 redirect to redirect from naked domain to www.? Is this worth a try or am I breaking DNS laws?