Separate naked domain and subdoman (www)

Is there a way to separate naked example.com to www.example.com?

What i need is to have separate virtualhost for these two names

example.com - different document root different ssl
www.example.com - different document root different ssl