Can you please suggest the correct format for the rewrite rule
Not without knowing what they're getting rewritten to and from!
Oh, wait, you mean the surface redirect.
old format from first post:
new format from follow-up post:
You mean they're exactly the same except that they used to start in MJ and now they start in MA? Can't you persuade your joomla installation to leave off that part too, if it's always the same?
If not, you're essentially using the rule you started out with-- minus the "index.php" in the middle (whew!).
Assuming ALL URLs in "MJ" will henceforth be "MA" instead, it now becomes simply
RewriteRule ^MJ/(.*) http://www.example.com/MA/$1 [R=301,L]
Opening anchor is crucial, but you don't need a closing anchor: the RewriteRule will happily capture anything and everything that comes after the leading /MJ
Then again, if you spent a little more time getting chummy with your RewriteRules, you could almost certainly dispense with the redirect altogether. It doesn't seem to do anything, so why not keep the original URL and tweak the rewrite instead? (The rule that takes your pretty URLs and changes them into something joomla can read.)