Hacker News new | ask | show | jobs
by 0x0 5264 days ago
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.
1 comments

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!