TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why Can’t Google Fix its Own URLs?

6 pointsby vineetdhanawatover 13 years ago
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 comments

deepanshumover 13 years ago
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 ;)
0x0over 13 years ago
<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 未加载