After 30 minutes of google-fu, I am now a regex master. Here's what I found out:
mod_rewrite doesn't process anything after a question mark in the URL. So if you have mysite.com/forum/index.php?threads/this-is-my-thread.20 it will ignore all the important stuff. You have to have a rewrite conditional to look for the query string.
I used a route filter to move /forums to /forum, and I never previously used the full friendly URLs, so this added some complexity to my problem. I solved it like this:
Code:
RewriteCond %{QUERY_STRING} ^forums/(.*)$ [NC]
RewriteRule ^forum/index\.php$ forum/%1 [NC,R=301,L]
So, for anybody that was as clueless as this stuff as I, it says that if there's a query string (the part after the question mark) that includes the string "forums/", rewrite the url that was forum/index.php as forum/whateverwasinthesecondsetofparenthesisintheaboveconditional.
I also had to add the following for the threads:
Code:
RewriteCond %{QUERY_STRING} ^threads/(.*)$ [NC]
RewriteRule ^forum/index\.php$ forum/threads/%1 [NC,R=301,L]
If you want to get picky, I could have written them for countless other routes, but these two redirects, plus a generic catch-all for the /forum/index.php case solved all the significant ones.
Code:
RewriteRule ^forum/index\.php$ forum [NC,R=301,L]
If you were using full friendly URLs previously, you could solve the redirect issues like Brogan described above.
This brief cheat sheet was immensely helpful in decoding the regular expressions in the rewrite rules:
http://borkweb.com/story/apache-rewrite-cheatsheet
If somebody has a more elegant solution than the above, I'm all ears. But this series of rules worked for me.