Simple and quick one 🙂 Just to rewrite non www traffic to www in Apache you can use the following snippet