TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why Can’t Google Fix its Own URLs?

6 点作者 vineetdhanawat超过 13 年前
Google's Add URL Page returns a 404 Error Page, works after removing a / (forward slash). Google engine itself returns the normal URL on a normal web search.

2 条评论

deepanshum超过 13 年前
It's a very common bug actually. When you use php_explode() for the REQUEST_URL for a case like '/webmasters/tools/submit-url' the array returned has a structure like array([0] => '', [1] => 'webmasters', [2] => 'tools', [3] => 'submit-url') Whereas in case of REQUEST_URL like '/webmasters/tools/submit-url/' the array returned has a structure like array([0] => '', [1] => 'webmasters', [2] => 'tools', [3] => 'submit-url', [4] => '') So, in the case with an extra '/' the length of aruguments increases and also the last argument becomes ''. Usually this is handled by busting the empty last and first array indexes. Thats why better to make your own function to decode urls when using them with .htaccess ;)
0x0超过 13 年前
<i>Question!</i> <i>I always assumed a URL is same with or without the ending / (forward slash). How can they behave differently?</i><p>The server just receives the URL from the client as a string; there's nothing in the protocol that requires a trailing slash to be ignored. Consider:<p><pre><code> if (REQUEST_URL == "/something") send_something() if (REQUEST_URL == "/something/") send_something_else() </code></pre> Many web servers, such as Apache, helpfully adds a missing slash if it detects that the URL you're trying to access actually maps to a directory in the file system.
评论 #3494881 未加载