Skip to content

MediaWiki Interwiki Links — Interwiki Prefixes, Database Config, and Wikimedia Projects

DodaTech Updated 2026-06-26 9 min read

In this tutorial, you will learn about MediaWiki Interwiki Links. We cover key concepts, practical examples, and best practices to help you master this topic.

Interwiki links in MediaWiki are shorthand cross-references that connect pages across wikis using configurable prefixes — enabling shortcuts like [[wikipedia:MediaWiki]] instead of full URLs, with prefix mappings stored in the database and extensible to any external wiki, exactly as Wikipedia uses interwiki links to reference sister projects.

What You'll Learn

  • Understanding interwiki link syntax
  • Configuring interwiki prefixes in the database
  • Adding custom prefixes for external wikis
  • Using Wikimedia project prefixes
  • Managing interwiki links with Special:Interwiki
  • Security considerations for interwiki links

Why It Matters

Interwiki links turn a single wiki into part of a connected ecosystem. A documentation wiki can link to Wikipedia articles for background concepts, to a partner wiki for related products, and to a bug tracker for issue references. Instead of typing full URLs like https://en.wikipedia.org/wiki/Encryption, users write [[wikipedia:Encryption]]. This keeps links readable, maintainable, and consistent across the wiki.

Real-World Use

A DodaTech documentation wiki configures interwiki prefixes for Wikipedia, a partner API documentation wiki, an internal bug tracker, and a Stack Overflow tag. Writers use [[wikipedia:OAuth]] to link to OAuth explanation, [[apidocs:authentication]] for the partner's docs, [[bugtracker:423]] for a specific issue, and [[stackoverflow:mediawiki-api]] for community Q&A. All configured from one admin interface.

Learning Path

flowchart LR
  A["28: Scribunto & Lua"] --> B["29: Cite & References"]
  B --> C["30: Interwiki Links"]
  C:::current
  D["31: Wiki Farms"]
  E["32: Content Translation"]
  F["33: Import & Export"]

  C --> D --> E --> F

  classDef current fill#38bdf8,color#0f172a,stroke-width:2px

An interwiki link uses a short prefix to reference a page on another wiki. The syntax is:

[[prefix:pagename]]

For example, [[wikipedia:MediaWiki]] renders as a link to https://en.wikipedia.org/wiki/MediaWiki. The text after the colon is the page title on the target wiki.

Feature Interwiki Link External Link
Syntax [[wikipedia:Page]] [https://example.com Page]
Readability Clean, short Full URL visible
Maintainability Change one prefix config Must update every URL
Link style Same as internal links Different style (arrow icon)
Works offline Yes (displays as plain text) No (URL visible)

Step 1: Understand Default Interwiki Prefixes

MediaWiki comes with preconfigured interwiki prefixes for Wikimedia projects:

Prefix Target
wikipedia https://en.wikipedia.org/wiki/
wiktionary https://en.wiktionary.org/wiki/
wikiquote https://en.wikiquote.org/wiki/
wikibooks https://en.wikibooks.org/wiki/
wikisource https://en.wikisource.org/wiki/
wikinews https://en.wikinews.org/wiki/
wikiversity https://en.wikiversity.org/wiki/
wikimedia https://wikimediafoundation.org/wiki/
commons https://commons.wikimedia.org/wiki/
meta https://meta.wikimedia.org/wiki/
mediawikiwiki https://www.mediawiki.org/wiki/

These work immediately without configuration. Type [[wikipedia:CMS]] on any page and it links to the Wikipedia article on content management systems.

Step 2: View and Manage Prefixes

Special:Interwiki

The Special:Interwiki page lists all configured interwiki prefixes. It shows:

Prefix          | URL                              | Forward
────────────────|──────────────────────────────────|────────
acronym         | https://www.acronymfinder.com/…  | No
commons         | https://commons.wikimedia.org/…  | No
mediawikiwiki   | https://www.mediawiki.org/wiki/   | No
wikipedia       | https://en.wikipedia.org/wiki/    | No

Adding a Prefix via Special:Interwiki

  1. Go to Special:Interwiki
  2. Click "Add an interwiki prefix"
  3. Fill in:
    • Prefix: dodatech
    • URL: https://wiki.dodatech.com/wiki/$1
    • Transclude: Unchecked (usually)
    • Forward: Unchecked
  4. Click "Submit"

Now [[dodatech:MediaWiki]] links to https://wiki.dodatech.com/wiki/MediaWiki.

Editing and Removing Prefixes

Click the "Edit" or "Delete" links next to each prefix on Special:Interwiki. Changes take effect immediately.

Step 3: Configure Interwiki via the Database

You can also manage interwiki prefixes directly in the database.

interwiki Table Structure

The interwiki table has these columns:

CREATE TABLE interwiki (
    iw_prefix VARCHAR(32) NOT NULL PRIMARY KEY,
    iw_url VARCHAR(255) NOT NULL,
    iw_api VARCHAR(255) NOT NULL,
    iw_wikiid VARCHAR(64) NOT NULL,
    iw_local BOOLEAN NOT NULL DEFAULT false,
    iw_trans BOOLEAN NOT NULL DEFAULT false
);

Adding a Prefix via SQL

INSERT INTO interwiki (iw_prefix, iw_url, iw_api, iw_wikiid, iw_local, iw_trans)
VALUES (
    'dodatech',
    'https://wiki.dodatech.com/wiki/$1',
    '',
    '',
    false,
    false
);

The $1 placeholder is replaced with the page name from the interwiki link.

Bulk Import

For bulk imports, use the maintenance/importInterwiki.php script:

php maintenance/importInterwiki.php --source=interwiki.csv

CSV format:

prefix,url,api,wikiid,local,trans
dodatech,https://wiki.dodatech.com/wiki/$1,,,0,0
partner,https://partnerwiki.com/wiki/$1,,,0,0

Step 4: Interwiki Transclusion

Interwiki transclusion allows including content from another wiki on your page. This requires the iw_trans flag to be enabled.

Enabling Interwiki Transclusion

UPDATE interwiki SET iw_trans = true WHERE iw_prefix = 'commons';

Transcluding External Content

{{commons:File:Logo.svg}}

This transcludes the file from Wikimedia Commons as if it were local. The content appears on your page as if it were uploaded to your wiki.

Security Considerations

  • Enable transclusion only for trusted wikis: Transcluding from an untrusted wiki can introduce malicious content
  • Wikimedia Commons transclusion is safe: Commons files are moderated
  • Performance: Remote transclusion adds load time to your pages

Interwiki prefixes can appear in URLs for convenient linking:

https://yourwiki/wiki/Wikipedia:Encryption

If Wikipedia is an interwiki prefix, this redirects to https://en.wikipedia.org/wiki/Encryption. This only works if the interwiki prefix is configured.

URL Forwarding

Enable URL forwarding for an interwiki prefix:

UPDATE interwiki SET iw_local = true WHERE iw_prefix = 'wikipedia';

With iw_local = true, the prefix appears as an interlanguage link in the sidebar.

Step 6: Custom Prefixes for Common Targets

Example: GitHub Issues

Add a prefix for GitHub issues:

  1. Go to Special:Interwiki
  2. Add prefix: github
  3. URL: https://github.com/dodatech/$1
  4. Submit

Usage: [[github:dodabrowser/issues/42]] links to issue 42.

Example: PHP Documentation

Add a prefix for PHP docs:

  1. Prefix: php
  2. URL: https://www.php.net/manual/en/$1.php

Usage: [[php:function.strlen]] links to the strlen documentation.

Example: Stack Overflow

  1. Prefix: stackoverflow
  2. URL: https://stackoverflow.com/questions/tagged/$1

Usage: [[stackoverflow:mediawiki]] links to MediaWiki-tagged questions.

Example: MDN Web Docs

  1. Prefix: mdn
  2. URL: https://developer.mozilla.org/en-US/docs/Web/$1

Usage: [[mdn:HTML/Element/a]] links to the anchor element docs.

Templates can use interwiki links dynamically:

= Template:SeeWikipedia =
See the Wikipedia article on '''[[wikipedia:{{{1|}}}|{{{1|}}}]]''' for more information.

Usage: {{SeeWikipedia|MediaWiki}} renders a link to the Wikipedia article on MediaWiki.

Dynamic Interwiki with Lua

function p.interwikiLink( frame )
    local prefix = frame.args[1] or "wikipedia"
    local page = frame.args[2] or ""
    return "[[" .. prefix .. ":" .. page .. "|" .. page .. "]]"
end

What You Learned

  • Interwiki links use [[prefix:pagename]] syntax
  • Wikimedia project prefixes are preconfigured
  • Special:Interwiki manages prefixes through a GUI
  • The interwiki database table stores prefix configurations
  • Interwiki transclusion includes external content
  • Custom prefixes connect to any external wiki or website
  • Templates can build interwiki links dynamically

In the next lesson, you'll learn about wiki farms — running multiple wikis from one installation.

Common Mistakes

Mistake Why It Happens How to Fix
Interwiki link renders as plain text Prefix not configured Add the prefix via Special:Interwiki or directly in the database. Verify the spelling matches exactly.
Interwiki link goes to wrong URL Incorrect URL pattern Check the URL format. It must include $1 as the page name placeholder. Example: https://en.wikipedia.org/wiki/$1.
Interwiki transclusion does not work iw_trans flag not set Update the database: UPDATE interwiki SET iw_trans = true WHERE iw_prefix = 'prefix'. Transclusion must also be enabled for the source wiki.
Cannot edit interwiki prefixes Insufficient permissions Only users with the interwiki permission can manage prefixes. By default, only bureaucrats have this right.
Prefix conflicts with existing namespace Prefix matches a namespace name If a namespace with the same name exists, the namespace takes priority. Choose a prefix that does not conflict with existing namespaces.

Practice Questions

  1. What is the syntax for an interwiki link pointing to the Wikipedia article "MediaWiki"?
  2. How would you add a custom interwiki prefix for the DodaTech wiki at https://wiki.dodatech.com?
  3. What is the difference between interwiki linking and interwiki transclusion?
  4. Challenge: Build an interwiki ecosystem. Configure interwiki prefixes for Wikipedia, Wikimedia Commons, and two custom targets (e.g., a GitHub Repository and a PHP documentation site). Create a wiki page that uses all four prefixes in context. Add a prefix for a partner wiki and test interwiki transclusion by embedding a Commons image using [[commons:File:Example.jpg]]. Create a template called "ExternalRef" that takes a prefix and page name and generates a formatted interwiki link with an icon. Finally, verify all links work correctly and open in the same or new tab as configured.

FAQ

Can I use interwiki links in edit summaries?

No. Interwiki links work only in page content. Edit summaries are plain text. Use full URLs if you need to reference external pages in summaries.

How do I change the language for Wikimedia interwiki links?

Language-specific prefixes are configured separately. For example, the French Wikipedia prefix is 'wikipediafr' (preconfigured). You can also add 'wikipediafr' pointing to https://fr.wikipedia.org/wiki/$1.

Can interwiki links be used in templates?

Yes. Interwiki links work inside templates just like regular wikilinks. This is useful for creating navigation templates that reference content on other wikis.

What happens when a user clicks an interwiki link?

The user is taken to the target page on the external wiki. The link opens in the same browser tab by default. You can configure nofollow or target attributes via the NoFollowLinks extension.

Are there security risks with interwiki prefixes?

Yes. An attacker who gains access to Special:Interwiki could redirect trusted prefixes to malicious sites. Restrict the 'interwiki' permission to trusted administrators only.

Mini Project

Goal: Build a connected wiki ecosystem using interwiki links.

  1. Configure default Wikimedia interwiki prefixes (verify they work)
  2. Add custom prefixes for:
    • Your own wiki (dodatech)
    • A GitHub repository (github)
    • MDN Web Docs (mdn)
    • PHP documentation (php)
    • Stack Overflow (stackoverflow)
  3. Create a "Resources" wiki page that uses all prefixes
  4. Enable interwiki transclusion for a trusted wiki
  5. Create a template "InterwikiRef" that formats interwiki links consistently
  6. Create a second wiki page "See Also" that links to related interwiki resources
  7. Test all links by clicking them
  8. Restrict the interwiki management permission to bureaucrats only
  9. Back up the interwiki table configuration

What's Next

Interwiki links connect wikis. Now let's look at running multiple wikis from a single codebase.

Continue to Lesson 31: Wiki Farms — learn how to set up and manage a wiki farm with shared code and separate databases.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro