Hey Lazyweb,
When my WordPress site got compromised, The Google began indexing links that have a “?y%” in the middle of the URLs:
http://www.markturner.net/2007/04/page/4/?y%/you-are-what-you-grow/
This turns the second half of the URL into a query string, which complicates fixing it a bit. I’ve tried a few RewriteCond rules but haven’t figured out this voodoo well enough yet:
RewriteCond %{QUERY_STRING} y\%/(.*) [NC]
RewriteRule (.*) $1 [R=302,L]
Anyone have any pointers on how to turn the above URL into this?
http://www.markturner.net/2007/04/page/4/you-are-what-you-grow/
P.S. WordPress 2.8 is now out. Time to upgrade!
First, use the backreference %1 in the RewriteRule instead of $1. %1 references the RewriteCond selection group, while $1 references earlier in the RewriteRule. Try:
RewriteRule (.*) $1%1 [R=302,L]
or something to that effect, there might be a missing slash in there somewhere. I’d use a 301 too, but that’s up to you.
I’ll give that a try. Thanks, Matt!