문제

Can I rely on the following statement?

A URL will redirect the client to some other URL if and only if it contains more than a single occurrence of "http://" and/or "https://"?

Note: by 'and/or' I mean that a single occurrence of each token is still counted as two occurrences.

I am guessing that the answer is no, because some URLs with only a single such token may still lead the client to a web-page that will then run some javascript, which will eventually redirect the client.

If the answer is indeed no, then is there any other way for me to determine that without "going into the URL" (with a URL-Connection, a browser, Selenium, etc)?

Thanks

도움이 되었습니까?

해결책

There's no way to know from the URL whether you will be redirected or not. For example, http://bit.ly/1dprzK4 redirects here- without any additional "http://" or "https://".

There is nothing in an URL that says you will or won't be redirected. Redirecting or not is the choice of the web server / application no matter what the URL looks like.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top