Thank you Kishan Sonar for your interest.
`The above code could have solved my problem with the .htaccess file.
Because I learnt that I was doing some thing wrong in cloudflare URL forwarding (page rules section). I was missing the wildcard ie https://domain1/* to domain2/$1 redirect.
I suggest reading the wilcard settings in the Cloudflare documentation in case anyone else has this problem.
Thank you.