Use our tool to generate the needed code to be placed into the .htaccess file for doing a correct redirect from www to non-www or vice versa.