跳转到内容

Help:URL

维基百科,自由的百科全书

这是本页的一个历史版本,由Kuailong留言 | 贡献2010年6月4日 (五) 15:12 URLs of Wikipedia pages编辑。这可能和当前版本存在着巨大的差异。

如同万维网上的所有页面一样,维基媒体基金会服务器上的页面也有自己的URL(统一资源定位符)来区分它们。这些URL地址在您浏览页面时,显示在浏览器的地址栏中。维基百科编者也可以通过创建超链接至指定的URL,链接到维基百科或维基媒体基金会的其他计划页面,抑或是网络上的其他页面。

链接到URL

在编辑一个页面时,链接至维基百科(或其他维基媒体基金会计划)的超链接通常使用[[...]]语法建立“维基内链”或“跨维基链接”。但是如果你想要链接到外部站点上,或者是特殊生成的维基媒体页面(例如一个条目的历史版本),就有必要提供完整的URL地址了。这需要使用外部链接语法来实现。

有三种形式的外部链接语法:

  • 如果直接在维基代码中输入URL地址,不加方括号,那么它就会原样呈现,并建立超链接:http://meta.wikimedia.org/的效果为 http://meta.wikimedia.org/
  • 如果URL被放置在方括号内,就会产生一个带计数标签的超链接:[http://meta.wikimedia.org/]的效果为[1]
  • 如果URL放置在方括号内,后面加上一个空格,并输入文本,那么后面的文本就会作为该超链接的标签:[http://meta.wikimedia.org/ Wikimedia]的效果为Wikimedia

想要隐藏箭头图标的话,请将外部链接置于 <span class="plainlinks">...</span>标签之间。

URL必须以“http://”、“https://”,“ftp://”或“irc://”。[1]另外URL中不能包含空格,而且必须只能包含下列字符,其他字符将自动转换为适当形式。

A-Z a-z 0-9 ._\/~%-+&#?!=()@:

Normally the desired URL can simply be copied and pasted from the address bar of your browser. If you are constructing the URL yourself for any reason, remember that certain reserved characters need to be percent coded. For example, ^ has to be written %5e, the hexadecimal ASCII value with a percent sign in front. A blank space within the title of Wikipedia article can also be converted into an underscore.

Higher Unicode characters can be included in URLs (like in internal links); the system will convert them as necessary. For example: http://meta.wikipedia.org/wiki/À_propos_de_Méta is equivalent to http://meta.wikipedia.org/wiki/%C3%80_propos_de_M%C3%A9ta .

For more details on how to make percent codes, see URLs in external links at Meta.

维基百科页面的URL

中文维基百科的URL地址都以 http://zh.wikipedia.org/ 开头。此地址本身会重定向至Wikipedia:首页

维基百科页面的URL地址有以下两种形式:

页面名有时可能包含名字空间前缀(例如本页的Help:)。一些Help:特殊页面可能会包含一个参数,例如 http://zh.wikipedia.org/wiki/Special:Contributions/Mountain (对于大多数特殊页面的参数,见下)。

Other URLs associated with a page are constructed by adding a query string. The string can be added to either of the above forms (as in http://en.wikipedia.org/wiki/Train?action=history ), but in this case the system defaults to the second form, i.e. it extends the index.php query string "title=Page_name".

Extended URLs are used:

If constructing URLs for Wikipedia pages, remember to convert spaces into underscores, and to percent-code special characters where necessary, as described in the previous section. (For how to do this in template code, see Templates and programming below.)

Various kinds of error message may appear if an invalid URL, or one to which you do not have access, is submitted. In other cases the URL may redirect to a valid one (for example, page titles are converted to their canonical form as they are when they appear in wikilinks).

其他维基媒体计划的URL

除了域名不同外,其他计划也使用和中文维基类似的URL: http://meta.wikimedia.org/ (元维基)、 http://en.wikipedia.org/ (英文维基百科)、 http://de.wiktionary.org/ (德文维基字典)等。

注意,如果输入http://www.wikipedia.org,你将会转到一个多语言的维基百科专题页面,但是其他以此开头的URL都会重定向到英文维基。

其他计划可能使用不同的字符串来取代URL中的“/w/”或“/wiki/”。详情参见元维基上的URL帮助页面。 中文维基中,可以使用“/zh/”(不转换)、“/zh-cn/”(大陆简体)、“/zh-tw/”(台湾正体)、“/zh-hk/”(港澳繁体)或“/zh-sg/”(马新简体)来实现繁简转换。

模板和编程

For use in templates, correct URLs can be constructed using certain magic words and parser functions such as fullurl, urlencode and others. Details of these can be found at mw:Help:Magic words.

Most programmatic interaction with Wikipedia can be performed most efficiently using the API, for which URLs beginning http://en.wikipedia.org/w/api.php are used. For details, see mw:API.

脚注

  1. ^ Note that URLs beginning "file://" do not work. This could be enabled (to work in MSIE only) by adding a $wgUrlProtocols entry to LocalSettings.php; see the $wgUrlProtocols in DefaultSettings.php for examples.

参见