#1 What's with IfModule? You've either got mod_rewrite or you haven't. (If you haven't, change hosts yesterday.)
#2 The quoted RewriteRule doesn't create a 301, only a 302.
#3 Since a redirect-- unlike a rewrite-- is visible to the naked eye, "cloaking" may not be the right word. To do it as a concealed rewrite you're talking proxies.
#4 Why bother with any of this stuff? Set up one domain as a mirror of the other. See the various search engines' wmt for information on internationalization and geotargeting. It is perfectly OK to have the same content on different URLs so long as it's clear that you have non-overlapping audiences, for example Australians and non-Australians.
a. I want to do a conditional 301. b. I only want to target search engines not people. c. Its important link value goes from the old to the new domain, though many people will still use the old domain.
Thats why i am doing it this way, and not doing an actual 301
your proposed ruleset implies you want to redirect based on the Referer header. do you really want to redirect based on the User-Agent (crawler identifier)? in that case you are talking about cloaking and you should implement a different plan.
Its important link value goes from the old to the new domain, though many people will still use the old domain.
danger! i would avoid anything that looks like an attempt to manipulate page rank or to show bots different responses than people.
Your fingers typed HTTP_REFERER but I think your brain meant HTTP_USER_AGENT.
It's still too general, though: in particular, it would include any and all googlebot spoofers. And there have got to be human browser add-ons that contain strings like "msn" or "aol".
Non-issue, though, because it isn't the right way to do what you're trying to do. Look up mirroring and geotargeting. You want to tell the search engines "Yes, these two domains are identical-- and they're supposed to be identical."
Edit for "D'oh!" moment: One of the domain names is .au. The other isn't. The search engines crawl from the US. You don't need to look at UA at all; you can simply redirect by the first part of the visitor's IP.