g1smd - 12:12 pm on Feb 7, 2013 (gmt 0) [edited by: g1smd at 12:45 pm (utc) on Feb 7, 2013]
Try a simpler redirect using
...\?folder=M([^\ ]+)\ HTTP/ without a slash in your pattern (where "
..." represents existing code that you don't alter), and redirect to
example.com/?target=M%1 and see what the slash looks like in the address bar of the browser after the redirect. Don't worry that the redirected URL returns 404, you're only interested in what the address bar changes to. Redirect to a completely different hostname if you want, you're only interested in what the new URL "looks" like.
[edit: fix typo]
[edited by: g1smd at 12:45 pm (utc) on Feb 7, 2013]