加号已替换为 %252520

发布于 2024-09-17 04:54:11 字数 316 浏览 3 评论 0原文

当我点击 Google 中的索引页面时,查询字符串中的加号将被替换(编码?)为 %252520。

有人知道为什么吗?

示例:

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

我应该

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

听说这是在 htaccess 中重定向我的网址的结果吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蘸点软妹酱 2024-09-24 04:54:11

如果 URI 查询中使用空格,则必须将其替换为 %20 (百分比编码)或通过 + (application/x-www-form-urlencoded 表单内容类型)。在您的情况下,数据似乎被编码了三次(% 使用 %25 进行编码)。

尝试使用以下规则将此类序列替换为 +

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]

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]
何以畏孤独 2024-09-24 04:54:11

实际上 %25% 字符,%20 是空格。所以看来您的 URI 被编码了三次

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

如您所见,% 被编码为 %25
因此,第一次,您会得到 %20 空间,然后您会得到 %25 ,表示 %20< 的 % /code> 后面跟着 20,然后再次使用相同的编码。

在将链接提供给 Google 之前的过程中可能存在问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文