I think I sorted it out… so far, this has the intended results:
RewriteCond %{HTTP_USER_AGENT} (msnbot|slurp|Googlebot|gigablast) [NC]
RewriteCond %{QUERY_STRING} (p=[0-9]+|page_id=[0-9]+) [NC]
RewriteRule ^.*$ /index.php?error=404 [R=301,L]
well, that’ll work fine — if you don’t mind killing your pagerank. 404s will nuke the original pages and their pagerank, whereas a 301 to the new permalinks could be done and retain pagerank for all existing pages.
if you don’t have real pagerank, or don’t care, yeah the 404 is a dirty-hack substitute. 😉
-d
I’m more worried about dupe-content than pagerank at this point, but thanks for the heads-up…
I’m not actually sure what the clean way would be…
I can’t 301 to the appropriate post/page because the querystring is by ID and my permalinks are by postname…
also, the SE’s already have all the permalink versions indexed, so I really just need to clean out the old pages that still work but I don’t want them indexed…
for everyone else’s benefit, it just occured to me that it’s probably better not to 301 to the error page, just rewrite – if an SE gets a 301 to a 404, it might just ignore the 301 not un-index the orig. page…
So the last line would then be:
RewriteRule ^.*$ /index.php?error=404 [L]