If you're running Apache you can just use the mod_rewrite engine (make sure the module is loaded). Simply edit .htaccess in your ubbthreads directory and add:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L]
With this enabled, accessing the site from anything but
www.domain.com will change to
www.domain.com.