since the rewrites are in the root, it might be very hard to make rules. You can try using rewrites using
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
to check if the file exists. It really depends what the URL was and what it becomes. If there's a pattern, you can combine the rules.
If there isn't a pattern, what I have done in the past is used a template to create static html files that redirect to the new page. Creating 25000 files might suck, so if you're bored you can create a PHP script to generate (write to) the needed files?
Here's the template I use:
Code:
<?php
header("HTTP/1.0 301 Moved Permanently");
header("Location: http://www.mydomain.com/path_to_file.html");