You will need to obviously change “casualcode.com” to your own domain.

The status code of the redirection is 301 Moved Permanently. A 301 redirect is the safest redirect because it helps preserve search engine ranking and page rank. Redirection should be setup properly on you web site now.

mod_rewrite is an Apache module which uses a rule-based rewriting engine, based on regular expression, to manipulate requested URLs on the fly.

Update

Google now has a feature for you to set the preferred domain in Google webmaster tools.