Moving WordPress from Subdomain To Root Domain

If you have a blog at http://blog.example.com/ and you want to move it to WordPress at – http://example.com/

You can put following htaccess rewrite rules on blog.example.com

RewriteEngine On
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

If you want blog homepage to redirect to – http://example.com/blog/ (you will need this if http://example.com/ has a static-homepage) then you can try following:

RewriteEngine On
RewriteRule ^/?$    http://example.com/blog/    [R=301,L]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

For other way round, refer to moving a WordPress blog from subdirectory to subdomain.