开发者

Is there a script or other method for obtaining the correct variation of a URL for a web page?

开发者 https://www.devze.com 2023-01-13 02:34 出处:网络
I\'m assuming there is a single correct variation of a URL for every page.Please correct me if I\'m wrong.

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 'https://stackoverflow.com/', (with a trailing slash).

EDIT: The API service I'm using is the Delicious A开发者_运维百科PI. In case that resonates with anyone's experience.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号