Hi men looking to get a 301 redirect working and getting trouble. I have to redirect sub.domain1.com to www.domain2.com and make certain that any file names or parameters get sent over and done with it.

This is exactly what I had been trying:

RewriteCond %{HTTP_HOST} ^domain1.com [NC] 
RewriteRule ^(.*)$ http://www.domain2.com/$1 [L,R=301] 

I additionally attempted this:

RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^sub\.domain1\.com$ /www.domain2.com? [R=301,NE,NC,L]

Where shall we be held playing up?

You skipped the subdomain part and proper getting away.

RewriteCond %{HTTP_HOST} ^sub\.domain1\.com$ [NC] 
RewriteRule ^(.*)$ http://www.domain2.com/$1 [L,R=301]

Further explain are available in this question.

Guideline for rewriterules: in the most complex towards the less complex. Also keep in mind the QSA directive (QSA = Query String Append = "make certain that any file names or parameters get sent over and done with it")

RewriteCond %{HTTP_HOST} ^sub\.domain1\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain2.com/$1 [QSA,R=301,L]

Let me know whether it works.