MediaWiki
lastmod 2026-10-29created 2014-01-0490 edits
MediaWiki is free web-based wiki software that uses PHP and MySQL and is distributed under the GNU GPL license. It is currently used by many Wikimedia Foundation projects such as Wikipedia, and is also widely used by other encyclopedia-style wikis.
The first version of this software was used in 2002 to meet the needs of the free-content encyclopedia Wikipedia. Since then, many companies have started using it as a content management system for internal knowledge management. Novell in particular uses it to run some of its high-traffic websites. Thousands of websites use MediaWiki. Some educators also have students use MediaWiki for collaborative group projects.
Users can change fine details with more than 700 configuration settings, and add or remove various features with more than 1,800 extensions. More than 600 automated and semi-automated bot programs and other tools are being developed, which help with editing MediaWiki sites.
Category
- MediaWiki:Template or List of Template: list of common templates to insert into pages.
- MediaWiki:Table: how to use tables.
- MediaWiki:PerformanceTuning: how to improve MediaWiki performance.
- MediaWiki:FileUpload: how to configure MediaWiki file uploads.
- MediaWiki:Cite: how to use the MediaWiki Cite Plugin. <-
<references />syntax. - MediaWiki:DumpHTML
- MediaWiki:CustomEditButtons
- MediaWiki:Update or MediaWiki:Dump: how to update and dump MediaWiki.
- MediaWiki:Install: how to install MediaWiki
- MediaWiki:Plugin - about plugins.
- MediaWiki:Permission - about permissions.
- MediaWiki:Api - MediaWiki API.
- MediaWiki:Developer
- MediaWiki:Extensions
- MediaWiki:Debug
- MediaWiki:SyntaxHighlight
- MediaWiki:WikiEditor
- MediaWiki:UserRights - user rights
- MediaWiki:ParserFunctions - lets you add things like conditionals to templates.
- MediaWiki:FulltextSearchEngines
- MediaWiki:HowToReadonlyBot - notes on how to make a read-only bot.
- Parsoid (Visual Editor)
- MediaWiki MCP Server
Python Libraries
- mwclient
- mwparserfromhell - the most powerful and general-purpose library; recommended when you need to modify wikicode.
- wikitextparser - good for extracting data such as tables.
- mwlib - use when you want to convert wiki pages to PDF, etc.
- pymediawiki - useful for fetching data from the MediaWiki API.
- mwfilter - one I made
Themes
Shortcuts
-
Ctrl+Alt+z: Main Page -
Ctrl+Alt+f: Search
How to use
Explanation of how to use MediaWiki.
Tables
Redirect
Redirects are used to send users from one page name to another. They can be useful when a particular page is referred to by multiple names, different punctuation, capitalization, or spellings.
Change logo
Just modify the following.
Ref TAG
References are used as follows.
Template
Wrapping the name of a template or page in curly braces {{ }} lets you transclude all or part of that template or page into another page. It works similarly to the HTML iframe (inner frame) and PHP's include("page path"). To specify the part to transclude, use the MediaWiki-specific tags onlyinclude, includeonly, and noinclude. None of these three tags take attribute values, and all require both an opening and a closing tag.
- onlyinclude
- Specifies the part to transclude when the template is used. Without this tag, the whole page is included by default. It is the most frequently used of the three tags, and it is best to place it right next to the part to transclude, unless you intentionally want a line break.
- includeonly
- Specifies the part that appears only when the template is transcluded into another page. It is often used to automatically categorize pages when a list template for a specific field, such as a navigation template, is transcluded.
- noinclude
- Specifies the part not to include when transcluding. Used for the template's own categories or description. If you used onlyinclude, there is no need to wrap the rest in noinclude.
TOC
-
__TOC__ - Inserts the TOC at that position.
-
__NOTOC__ - Removes the TOC.
-
__FORCETOC__ - Forces the TOC to display even if there are fewer than 4 headings.
Hide the TOC on printed pages
Backup script
Use the script below to back up. You can also use cron, etc. to back up regularly.
#!/bin/bash
MEDIAWIKI_ROOT=/var/www/html
MAINTENANCE_DIR=$MEDIAWIKI_ROOT/maintenance
DATE_FORMAT=`date +%Y%m%d_%H-%M-%S`
DB_XML_NAME=wiki-db-$DATE_FORMAT.xml
FILE_TAR_NAME=wiki-file-$DATE_FORMAT.tar.gz
CLEANUP=true
php $MAINTENANCE_DIR/dumpBackup.php --full --uploads > $DB_XML_NAME
tar czf $DB_XML_NAME.tar.gz $DB_XML_NAME
tar czf $FILE_TAR_NAME $MEDIAWIKI_ROOT
if [[ "$CLEANUP" == true ]]; then
rm $DB_XML_NAME
fi
Raw Backup
mysqldump -h localhost -u wikiuser -p my_wiki > backup.sql
tar czf images.backup.tar.gz /var/www/html/images
cp LocalSettings.backup.php images.tar.gz /var/www/html/LocalSettings.php
How to restore
After restoring the /var/www/html/images folder, change the permissions:
Restore the database backup:
Namespace Number
| Number | Canonical name |
| -2 | Media |
| -1 | Special |
| 0 | (Main) |
| 1 | Talk |
| 2 | User |
| 3 | User talk |
| 4 | Project |
| 5 | Project talk |
| 6 | File |
| 7 | File talk |
| 8 | MediaWiki |
| 9 | MediaWiki talk |
| 10 | Template |
| 11 | Template talk |
| 12 | Help |
| 13 | Help talk |
| 14 | Category |
| 15 | Category talk |
Specal
Notes on the list of special pages.
- MediaWiki:Sidebar - special page for editing the Sidebar. 1
- MediaWiki:Common.css - edit the common CSS used globally.
General information
- Special:SpecialPages
- Special:AllMessages
- Special:Statistics
- Special:Version - check the version, installed plugins, etc.
- Special:MyPage/common.css - edit the common CSS for the logged-in user.
Page listings
- Special:AllPages
- Special:PrefixIndex
- Special:Categories
- Special:ListFiles
- Special:ListRedirects
- Special:ProtectedPages
- Special:ProtectedTitles
- Special:PagesWithProp
- Special:Mostrevisions - list of the most edited pages
See also
Favorite site
- MediaWiki web site
- MediaWiki Help: Formatting
- MediaWiki Extension: SyntaxHighlight GeSHi
- 5 tips to improve your MediaWiki site’s SEO
- Guchani's collection of odds and ends: Using programs/wik
- [Recommended] Default LocalSettings.php settings right after installing MediaWiki – Weft and Warp – IT
How to use
Documentation
Troubleshooting
Article
- Vue.js has been selected as Wikimedia Foundation's future JavaScript framework - Wikimedia selects Vue.js as its next-generation JS framework
- Also forms a Wikimedia Design System team and prepares a shareable Vue.js UI component library
References
-
When importing with
maintenance/importDump.php, you have to save it again for it to display correctly. ↩