Manual:Interwiki

Interwiki links are links to pages of other projects, using a prefixed internal link style.

Interwiki links make it possible, to link to pages of (e.g.) Wikipedia, Wikibooks, Wikinews etc. or to your wiki-project in different languages (see Manual:Wiki family).

A link like  will appear like this: Main Page and redirect you to Wikipedia's Main Page.

Interwiki links to other projects
Interwiki links are hosted in the interwiki table of the Mediawiki database. The list is available from the interwikimap property of the siteinfo meta query API, in other words

Default
Several Wikimedia projects (and others) are ready for interwiki linking by default, so you can use them without editing your database. Note that Wikipedia was only added as one of the interwiki defaults since v1.10

The following are some examples of interwiki prefixes which are available by default:

Adding a new website for interwiki linking

 * Interwiki links are set in the  table of the database.
 * To modify these, you will need to edit the database, as below.
 * You might prefer to install an Interwiki extension, which eases the process.

As the Wikipedia isn't set up by default in version 1.9 and before, you might want to add it (and other projects that you desire).

The examples below show how to set up  as a link to the English Wikipedia.

The idea is to insert a line of the form: ('prefix', 'URL format string', 1, 0) into the  table.

Single line
Advanced users may use a single command line, as follows:
 * MySQL and PostgreSQL

INSERT INTO interwiki (iw_prefix, iw_url, iw_local, iw_trans) VALUES ('w', 'http://en.wikipedia.org/wiki/$1', 1, 0);

Export, add, re-import
Alternatively, you can use the following multi-step process, which exports the interwiki table, adds a line, then re-imports it:

('w', 'http://en.wikipedia.org/wiki/$1', 1, 0);
 * Export the database table
 * add to the end of the table a line of the following form (using English wikipedia as an example):


 * Import the database table

To test
To test configuration:
 * Go to your site,
 * create an article, with the following content:
 * This should display a link to the 'Village pump' page on en.Wikipedia.org (the url )
 * This should display a link to the 'Village pump' page on en.Wikipedia.org (the url )

Field documentation
In detail, the fields of the  database table are as follows:
 *  : choose a prefix, which is used for interwiki linking, e.g. "wikipedia" for linking to Wikipedia.
 *  : enter the project's URL, e.g.  for Wikipedia. Don't forget the   as it is replaced with the article's name you are linking to (  links to  ).
 *  : enter the project's URL, e.g.  for Wikipedia. Don't forget the   as it is replaced with the article's name you are linking to (  links to  ).
 *  : if 1, your wiki will redirect even external links of the form iw_prefix:title, not only those from its own pages. you need this if you want to use the redirect functionality from outside your wiki or other wikis use your transwiki functions for nested transwiki links (like w:en:fr:Wikipédia:Accueil principal)
 *  : "transwiki transclusion" - set to 1 if you want to use pages from the other wiki as templates. You will also need to set $wgEnableScaryTranscluding = true in your LocalSettings.php
 *  : URL to the MediaWiki API, e.g.  (optional).
 *  : Database name of the wiki (If locally accessible). May be used (later?) for interwiki transclusions. (optional)