Question

If this full URL:

http://domain.com/dir/file.css

Is an "absolute URL", where the link will work from any website.

And this:

../dir/file.css

Is a "relative URL", where the link will only work from that directory path.

What is the combination of those two called…

/dir/file.css

Where the link will work from any location on that site?

Was it helpful?

Solution

Your first example is a URL. Your second and third examples are not URLs, they're paths. If the path begins with / then it's an absolute path, otherwise it's a relative path.

Web browsers generally understand how to interpret a path in relation to the "current" host and path.

OTHER TIPS

You’re basically talking about a URI scheme. In your example:

/dir/file.css

This is considered the path:

/dir/

And this is the filename:

file.css

So saying “hostname plist path & filename” is a safe bet. Or perhaps /dir/file.css can be considered the root path since the / at the beginning anchors it to the hostname part of the URL.

This diagram from Wikipedia explains it well:

foo://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose
  \_/   \_______________/ \_________/ \__/            \___/ \_/ \______________________/ \__/
   |           |               |       |                |    |            |                |
   |       userinfo         hostname  port              |    |          query          fragment
   |    \________________________________/\_____________|____|/ \__/        \__/
   |                    |                          |    |    |    |          |
   |                    |                          |    |    |    |          |
scheme              authority                    path   |    |    interpretable as keys
 name   \_______________________________________________|____|/       \____/     \_____/
   |                         |                          |    |          |           |
   |                 hierarchical part                  |    |    interpretable as values
   |                                                    |    |
   |            path               interpretable as filename |
   |   ___________|____________                              |
  / \ /                        \                             |
  urn:example:animal:ferret:nose               interpretable as extension

                path
         _________|________
 scheme /                  \
  name  userinfo  hostname       query
  _|__   ___|__   ____|____   _____|_____
 /    \ /      \ /         \ /           \
 mailto:username@example.com?subject=Topic
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top