Apache redirecting www to no-www

Every time I have to configure apache to host a new website, there is always a small SEO voice in my head asking me:

Did you create a www alias pointing to the website?

So let's go satisfy this little voice together.

Let's say our brand new url is http://example.com. We want to configure apache to redirect from http://www.example.com  to our new url. 

There are many solutions for that out there, but today I would like to share with you my favorite one.