---- Spam words in a query string - do these backlinks hurt rankings?
dusky - 10:41 pm on May 8, 2010 (gmt 0)
Just a word of caution. Some people are tempted to preserve the link juice coming from such spam backlinks, and that's why they use a 301 to the same URL without the query string.
I implemented the solution having what you said in mind, and yes many spam links are redirected to the correct page as some of them already give healthy PR, I say spam links, sometimes they were only spelling mistakes of postings of a link to an interesting article or forum post / blog etc which would give a 200 correct header even though the URL is different but the page is correct, so redirecting to the correct page instead of 404 in that case is better and I have that as part of my solution. g1smd's note about not using wildcard is a good one though.
The original rule could never work. It required the filename in the RewriteRule pattern to match index.php but needed the filename in the RewriteCond pattern to match index.html and it could never match both requirements at the same time.
It'll work only if someone is using the corresponding CMS and already implementing / using the short URLs method. I have sites that use the old Postnuke .764 and Zikula, and the fix (my fix) works on both. For other CMSes, a slight tweak should be undertaken, incidently, your tweak above as it is (the second one) won't work on CMSes that need the index.php or modules.php as the starting URL before any short URLs implementations, it needs a tweak I guess to work on any, wonder if you or someone else can have a go and make it cross-CMS fix. Note that /path-does-not-exist would redirect to the custom 404 error page if you nhave one anyway!
So the final tweaked (when using postnuke, Zikula type URls and short URLs) fix with your added advice about not using wildcards is: