lucy24 - 9:27 am on Aug 1, 2012 (gmt 0)
RedirectMatch 301 ^/undefined http://www.example.com/
Actually, what the $1 does do is redirect any added "undefined" on any other page to the index page...
Uhm, no, it doesn't. The code has a beginning anchor ^ so it will only work at the root level. To redirect all pages with trailing "undefined" you have to leave off the anchor.
The $1 means "reuse the first captured group". Remember, we're in RedirectMatch, which speaks RegEx. Different from vanilla Redirect. Since there is no captured group, there's nothing to reuse. Matter of fact, some servers might get seriously upset. They don't mind empty groups like (blahblah)? but they can have strong opinions about groups that haven't been defined at all.
You do not want to upset your server. If jdmorgan were here, he could come up with 500 reasons why not ;)