How to make www.x.com and x.com the same, one should be redirect 301?

Comments

Use a CNAME record

Not really a Drupal question, but I'll still have a go.

I believe this is the sort of thing CNAME (Canonical Name) is designed to do: http://en.wikipedia.org/wiki/CNAME_record

You configure this in your DNS setup.

Your A record is supposedly x.com, and then create a CNAME record giving it the alias www.x.com.

(I would not use Apache redirect for this.)