Jump to content

Help:URL

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jessica20202020 (talk | contribs) at 01:12, 14 June 2020 (Linking to URLs). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Like all pages on the World Wide Web, the pages delivered by Wikimedia's servers have URLs to identify them. These are the addresses that appear in your browser's address bar when you view a page. Wikipedia editors also have the ability to create hyperlinks to chosen URLs, pointing to pages either within Wikipedia and other Wikimedia projects, or elsewhere on the Web.

Dropping http: and https:

If you make an external style link using square brackets [...] from a Wikimedia page to other Wikimedia page, including Wikipedia of course, it's better to drop the protocol http: or https:, so that the URL begins with //..., e.g. //en.wikipedia.org/w/index.php?title=Help:URL.

Otherwise, readers are forced to use the specified connection method. If you don't specify the protocol, readers can continue to use the protocol to read that page.

The URL returned by {{SERVER}} magic word begins with //.

  • Example: [//en.wikipedia.org/w/index.php?title=Help:URL no protocol]
  • Result: no protocol (Read this page both with http and https.)
  • Example: [{{SERVER}}/w/index.php?title=Help:URL no protocol]
  • Result: no protocol (Read this page both with http and https.)

URLs of Wikipedia pages

English Wikipedia's URLs begin http://en.wikipedia.org/. That address on its own is redirected to the Main Page.

The page name may include a namespace prefix (such as "Help:" in this page). With some special pages it may also include a parameter, as in http://en.wikipedia.org/wiki/Special:Contributions/Jimbo_Wales (but for most special page parameters, see below).

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).

Shorter URL

An unofficial redirect site mentioned at User:Tl-lomas/enwp.org offers two types of shorter URL.

The first form is not controlled by the Wikimedia Foundation, so it could stop working or change purpose at any time.

The second form also works like TinyURL to make a long page name into a short code. It uses pageid, which remains accurate even if the page name is moved. Pageid has up to 8 digits, shown by clicking "Page information" under "tools" on the left side of the page.

URLs on other Wikimedia projects

Other projects use similar URLs to those of English Wikipedia, except that the domain names vary: http://meta.wikimedia.org/ (Meta), http://fr.wikipedia.org/ (French Wikipedia), http://de.wiktionary.org/ (German Wiktionary), etc.

Note that http://www.wikipedia.org leads to an international Wikipedia portal page, but other URLs beginning with that prefix redirect to English Wikipedia.

Other projects may also use different strings in place of "/w/" and "/wiki/" in URLs. For details, see the URL help page on Meta.

Templates and programming

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.

See also