views:

71

answers:

1

I'm assuming there is a single correct variation of a URL for every page. Please correct me if I'm wrong.

Given an input of an equivalent URL, I need to get the correction of a URL. For example, most browsers accept slight variations from the exact URL but then correct it to take you to the right page? (Or perhaps this is done at the DNS level?)

The task I'm working on is getting the correct MD5 hash of a URL that will be recognized by an API service that returns information about a URL. For example, if I hash 'http://stackoverflow.com', I get an empty response. In order to get a valid response I need to hash 'http://stackoverflow.com/', (with a trailing slash).

EDIT: The API service I'm using is the Delicious API. In case that resonates with anyone's experience.

+1  A: 

I'm assuming there is a single correct variation of a URL for every page. Please correct me if I'm wrong.

There is only a single "correct" one if the author decides that there should be, then they will likely use a combination of canonical and HTTP redirects to push people in that direction.

For example, most browsers accept slight variations from the exact URL but then correct it to take you to the right page?

Host names are case insensitive, and the root doesn't need a slash (so http://example.com and http://EXAMPLE.cOM/ are identical).

Beyone that, the rest of the URL (except for a fragment identifier if there is one) is handled entirely by the HTTP server. It might treat it case sensitive, it might not. It might require things in a certain order, it might not.

David Dorward