This is the universal code for redirection. First of all lets redirect from www to non-www with our .htaccess file.
#Use this for non-ssl URL redirection <IfModule mod_rewrite.c> RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] </IfModule>