Search code examples
urlabsolute-path

Absolute URL and relative URL


Here's the homepage of Stony Brook University: http://www.stonybrook.edu/

There's a link whose anchor text is "Academics" on the homepage. By checking the source code of the page, I find that the "Academics" link has a relative URL: academics.shtml.

To my surprise, the absolute URL: http://www.stonybrook.edu/academics.shtml isn't that of the "Academics" link. In fact, it does not exist at all. The correct absolute URL for the "Academics" link is: http://www.stonybrook.edu/sb/academics.shtml

I'm confused where the path /sb/ comes from. I'm asking about it because I'm trying to obtain the absolute URL based on the base URL and relative URL using the Java URL class.


Solution

  • Also from the source:

    <base href="http://www.stonybrook.edu/sb/" />