Абсолютные URL, относительные URL и …?

string username = email.Split('@')[0];
string domain = email.Split('@')[1];
28
задан unor 2 October 2015 в 22:45
поделиться

4 ответа

Here are the URL components:

http://www.example.com/en/public/img/logo.gif
\__/   \_____________/\_____________________/
 #1     #2             #3
  1. scheme/protocol
  2. host
  3. path

A URL is called an absolute URL if it begins with the scheme and scheme specific part (here // after http:). Anything else is a relative URL.

A URL path is called an absolute URL path if it begins with a /. Any other URL path is called a relative URL path.

Thus:

  • http://www.example.com/en/public/img/logo.gif is a absolute URL,
  • ../../public/img/logo.gif is a relative URL with a relative URL path and
  • /en/public/img/logo.gif is a relative URL with an absolute URL path.

Note: The current definition of URI (RFC 3986) is different from the old URL definition (RFC 1738 and RFC 1808).

The three examples with URI terms:

  • http://www.example.com/en/public/img/logo.gif is a URI,
  • ../../public/img/logo.gif is a relative reference with just a relative path and
  • /en/public/img/logo.gif is a relative reference with just an absolute path.
70
ответ дан 28 November 2019 в 02:45
поделиться

Иногда его называют виртуальным URL-адресом, например в SSI:

<!--#include virtual = "/lib/functions.js" -->
0
ответ дан 28 November 2019 в 02:45
поделиться

Имейте в виду, сколько сегментов URL-адреса можно опустить, сделав их относительными (примечание: все они примерно). Все это действительные URL:

  • http://example.com/bar?baz
  • ? Qoo = qalue
  • / bar2
  • dat / sly
  • //auth.example.com (большинство людей удивлены этим! Будет использоваться http или https, в зависимости от текущего ресурса)
  • #anchor
0
ответ дан 28 November 2019 в 02:45
поделиться

Я видел, что он называется корневым относительным URL .

0
ответ дан 28 November 2019 в 02:45
поделиться
Другие вопросы по тегам:

Похожие вопросы: