i have a bunch of miss-generated URLs, which i would like to redirected to the correct URL.
This is a good example:
http://example.com/search/?q=searchterm%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F&scope=45%2F%2F%2F%2F%2F/
I already could redirect most of them with the following rule:
RewriteCond %{QUERY_STRING} ^(.*)%2F RewriteRule ^search/$ /search/?%1 [NE,R=301,L]
As i understand, this only works because the trailing "%2F" is removed and then the rule hits again. Google only accepts a limited number of redirects.
So i try to adapt the rule to work with 1 or more occurrences of "%2f"
This is how far i got:
RewriteCond %{QUERY_STRING} ^(.*)((%2F)*) RewriteRule ^search/$ /search/?%1 [NE,R=301,L]
The results are: /search/?q=searchtermFFFFFFFFFFFFFFFF&scope=45FFFFF/
What am i missing?
Best regards, Alexander