绝对网址、相对网址和...? [英] Absolute urls, relative urls, and...?

查看:45
本文介绍了绝对网址、相对网址和...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一些文档,但我的词汇量有点问题:

I am writing some documentation and I have a little vocabulary problem:

  1. http://www.example.com/en/public/img/logo.gif 被称为绝对"网址,对吗?
  2. ../../public/img/logo.gif 被称为相对"网址,对吗?
  3. 你怎么称呼它:/en/public/img/logo.gif?
  1. http://www.example.com/en/public/img/logo.gif is called an "absolute" url, right?
  2. ../../public/img/logo.gif is called a "relative" url, right?
  3. so how do you call this: /en/public/img/logo.gif ?

它是否也被视为绝对网址",尽管没有协议和域部分?

Is it also considered an "absolute url", although without the protocol and domain parts?

或者它被认为是一个相对的 url,但相对于域的根?

Or is it considered a relative url, but relative to the root of the domain?

我用谷歌搜索了一下,有些人将其归类为绝对的,而其他人则归类为相对的.

I googled a bit and some people categorize this as absolute, and others as relative.

我应该怎么称呼它?一个半绝对网址"?还是半亲属"?还有别的词吗?

What should I call it? A "semi-absolute url"? Or "semi-relative"? Is there another word?

推荐答案

以下是 URL 组件:

Here are the URL components:

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

  1. 方案/协议
  2. 主持人
  3. 路径

一个 URL 被称为 绝对 URL 如果它以方案和方案特定部分开头(这里 //http:).其他任何内容都是相对网址.

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.

URL 路径如果以 / 开头,则称为 绝对 URL 路径.任何其他URL 路径都称为相对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.

因此:

  • http://www.example.com/en/public/img/logo.gif 是一个绝对网址
  • ../../public/img/logo.gif 是一个相对 URL,带有相对 URL 路径
  • /en/public/img/logo.gif 是一个相对 URL,带有绝对 URL 路径.
  • 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.

注意:URI 的当前定义(RFC 3986) 不同于旧的 URL 定义(RFC 1738RFC 1808).

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

带有 URI 术语的三个示例:

The three examples with URI terms:

  • http://www.example.com/en/public/img/logo.gif 是一个 URI
  • ../../public/img/logo.gif 是一个相对引用,只有一个相对路径
  • /en/public/img/logo.gif 是一个相对引用,只有一个绝对路径.
  • 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.

这篇关于绝对网址、相对网址和...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆