1

When I click on my index'd pages in Google the plus signs in my query string are being replaced (encoded?) for %252520.

Anyone know why?

Example:

lovelakedistrict.com/result/?q=Private%252520car%252520park&page=2

should be

lovelakedistrict.com/result/?q=Private+car+park&page=2

I have heard that this is a result of redirecting my urls in htaccess?

4

2 回答 2

3

If a space is used in the URI query, it must either be replaced by %20 (percent encoding) or by + (application/x-www-form-urlencoded content type for forms). In your case the data seems to be encoded three times (% is encoded with %25).

Try these rules to replace such sequences it with +:

RewriteCond %{QUERY_STRING} (.*?)%(25)+20(.*?%(25)+20.*)
RewriteRule ^ %{REQUEST_URI}?%1+%3 [N]
RewriteCond %{QUERY_STRING} (.*?)%(25)+20(.*)
RewriteRule ^ %{REQUEST_URI}?%1+%3 [L,R=301]
于 2010-09-01T15:47:36.383 回答
2

Actually %25 is the % char, %20 is the space. So it seems your URI was encoded three times

http://www.lovelakedistrict.com/result/?q=Private car park&page=2 =>
http://www.lovelakedistrict.com/result/?q=Private%20car%20park&page=2 =>
http://www.lovelakedistrict.com/result/?q=Private%2520car%2520park&page=2 =>
http://www.lovelakedistrict.com/result/?q=Private%252520car%252520park&page=2

As you can see, a % is encoded as %25.
So the first time, you get %20 for the space, then you get a %25 for the % of %20 followed with the 20, then, again, same encoding.

There is probably something wrong in the process before the link is provided to Google.

于 2010-09-01T15:53:17.893 回答