Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top