You have migrated your WordPress site to a new domain but want all posts to be redirected to the same post on the new domain. So if someone accesses myoldsite.com/blog/sample-post you would like them redirected to mynewsite.com/blog/sample-post
Simple:
On your old domain, locate your .htaccess file using a FTP program such as filezilla
Add the below to the file and save
Replace the domain names as required:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
For example:
If your old domain is myoldsite.com
and new site is mynewsite.com, the code should look like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^myoldsite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.myoldsite\.com$
RewriteRule (.*)$ http://www.mynewsite/$1 [R=301,L]
</IfModule>