

Why Can’t Google Fix its Own URLs? - vineetdhanawat
http://www.vineetdhanawat.com/blog/2012/01/why-cant-google-fix-its-own-urls/
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.
======
deepanshum
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
_Question!_ _I always assumed a URL is same with or without the ending /
(forward slash). How can they behave differently?_

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:

    
    
      if (REQUEST_URL == "/something") send_something()
      if (REQUEST_URL == "/something/") send_something_else()
    

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.

~~~
vineetdhanawat
Oh, the I guess its same as doing via .htaccess file on a linux host.

But then surprisingly Google is returning a 404 error page to its own search
result!

