4

After reading and seeing the samples here

Given the example of uri :

 http://a/b/c/d;p?q

redirecting to "g" will redirect me to http://a/b/c/g ( cause c is the directory)

So I ask myself when should i use ./g

It is actually the same [goto current folder and find g]

so Why this syntax is even exists ? ./ when should I use it ?

Community
  • 1
  • 1
Royi Namir
  • 144,742
  • 138
  • 468
  • 792

2 Answers2

2

The generic URI syntax consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment.

  URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

  hier-part   = "//" authority path-abempty
              / path-absolute
              / path-rootless
              / path-empty

The scheme and path components are required, though the path may be empty (no characters). When authority is present, the path must either be empty or begin with a slash ("/") character. When authority is not present, the path cannot begin with two slash characters ("//"). These restrictions result in five different ABNF rules for a path (Section 3.3), only one of which will match any given URI reference.

  The following are two example URIs and their component parts:

         foo://example.com:8042/over/there?name=ferret#nose
         \_/   \______________/\_________/ \_________/ \__/
          |           |            |            |        |
       scheme     authority       path        query   fragment
          |   _____________________|__
         / \ /                        \
         urn:example:animal:ferret:nose
NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
2

I'd put it this way:

There is no special reason why this construct exists (or was created/defined). It simply exists because it is a logical combination of other constructions (., /,/g) that are required and thus defined out of other reasons. Since those constructions (path components here) can be combined more or less without limitation the questionable constrcut ./g is well defined and thus valid. But that does not mean that there must be special reason why exactly this construct was or has to be defined.

arkascha
  • 41,620
  • 7
  • 58
  • 90