Of cause you want to make a proper 301 redirect from a domain.com to www.domain.com to avoid duplicate content and a bad standing at Google.

If your DNS hosting provider doesn’t provide with a redirect solution, you should make the redirect by yourself.

When using the script based solution (eg. PHP’s header syntax) you either need two sites, or a if-then solution in the code.

mod_rewrite in htaccess is much easier.

Requires the mod_rewrite module is enables, and ‘AllowOverride’ directive to ‘All’ in your virthost setup.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

/Renzo