MediaWiki FAQ

From Meta, a Wikimedia project coordination wiki
(Redirected from MediaWiki FAQ.)
Jump to navigation Jump to search

NOTE: this page is being replaced by mw:Manual:FAQ on If your question isn't in here, look there.

Blue Glass Arrow.svg MediaWiki logo.png
This page should be moved to
Please do not move the page by hand. It will be imported by a administrator with the full edit history. In the meantime, you may continue to edit the page as normal.


In general[edit]

Are "Wikimedia" and "MediaWiki" the same thing?[edit]

No. Wikimedia is the name of a group of wiki-based open-content projects managed by the non-profit Wikimedia Foundation. MediaWiki is the underlying software interface of these collaborative projects.

For further clarification, see our article on the names.

I tried that but it didn't work[edit]

I had a problem, I came to this page and it told me how to fix it. But it didn't work, the problem is still there!!!!

Nine times out of ten this is because you didn't clear your cache. The simple test for this is to request a page that hasn't been requested before. Select the part of the URL in the address bar that contains the page title (e.g. Main_Page). Twiddle your fingers on the keyboard for a while, hit enter. Check if the problem is on that page too.

MediaWiki uses both a server-side cache and a client-side cache, so clearing your browser cache is often not enough. See the relevant entry below for more details.

Here are some other things to check:

  • Were you editing the right file? Try inserting some garbage into the file you edited, does it break anything?
    • A great debugging tool in this case is to create a file called phpinfo.php, containing only <?php phpinfo() ?> . Upload it into your web directory and invoke it with your browser. Check the document root and the path to php.ini.
  • Were you editing the right part of the file? Did you create a duplicate entry in php.ini? Add new settings to the end of LocalSettings.php (but before the ?>), not to the beginning.
  • If you created a .htaccess, are you sure AllowOverrides is on? Ask your hosting provider.

If none of these things work, see the two entries below on how to get more help.

Where should I post my bug report/feature request?[edit]

Please post all bug reports and feature requests at Please search through existing entries beforehand, to check that the problem isn't fixed in a newer release version of the software, and to ensure we don't have duplicate entries.

I have a question not answered in this FAQ. Where should I ask it?[edit]

You can either

  1. Email the mediawiki-l mailing list, or
  2. Ask in our IRC channel

my question is already edited, is "Wikimedia" and "MediaWiki" the same thing--Testking JN0-350?


See also:

How do I install MediaWiki? What are the system requirements?[edit]

See Help:Installation

Is it possible to install more than one wiki (MediaWiki) on a server? How?[edit]

Yes, MediaWiki can be installed multiple times in different directories using either the same database with a different set of table prefixes (configurable upon install) or using different databases altogether.

Additionally, you may want to make some settings common for all the installations, and have a central place where changes to these can be made. Since the configuration file (LocalSettings.php) is executed as PHP code, this can be done with PHP's inclusion mechanism - for instance, by adding the line include_once("../CommonSettings.php") in each LocalSettings.php, and placing settings which apply to all wikis in ../CommonSettings.php.

If you have a large number of wikis on one host, you may not want to keep a separate copy of the source code for every one. Instead, extract the source somewhere, and for each wiki installation, symlink the entire MediaWiki directory with the sole exception of the LocalSettings.php file. This can be accomplished with the lndir command (available on some Linux installations) or an equivalent tool.

You can then either use a separate LocalSettings.php for each wiki, or (easier to maintain) determine the settings based on the URL. See also Wiki farm.

If you want your login to be persistent across Wiki's running on the same server, simply add the following line to your LocalSettings.php after $wgSiteName = ... :

ini_set("", "{$wgSitename}Session" );

(Though you can expect some trouble if $wgSiteName contains spaces. In that case replace {$wgSiteName} with an explicit space-removed version). $wgSecretKey (or deprecated $wgProxyKey) must be the same across your wikis for persistent logins to work.

Have a look at

How to install more than one wiki on a single server, using the same source code, and using the same database (v1.5.1, May 2006)[edit]

Here is how to install the Mediawiki software just once, but use it to power more than one wiki, keeping the tables for all the wikis in a single database-- including step-by-step instructions for a Unix-type of installation. This solution should work for most shared-hosting servers, too. Level of difficulty: Novice. See the instuctions here Srumberg

How to install multiple wikis, each with their own database, using the same source code. (v1.5+, June 2010)[edit]

Steve Rumberg's method is used with a small variation. Instead of changing the database prefix, which changes names of database tables and entries, you change the database name, and duplicate the database with a new name. The effect is that you can create and then duplicate a mature template wiki. Here are the steps:

1. LocalSettings.php - add the code that Steve recommends. This is done once for the first two wikis.

2. LocalSettings_wiki1.php - create this file as Steve recommends but comment out the line containing $wgDBprefix, and insert a line naming the database for this, first, wiki. Note the other lines in the following example:

   # $wgDBprefix = "wiki1";
   $wgDBname     = "sitename_wiki1db";
   $wgLogo = "$wgStylePath/common/images/wiki1_logo.gif";
   $wgArticlePath = "/wiki/index.php/$1?w=wiki1";

3. Duplicate LocalSettings_wiki1.php, replacing instances of the string "wiki1" with "wiki2", for example. I tended to use short, four-letter codenames, such as wiki, john, and whsx, names that reminded me of the site name.

4. Duplicate a "template" database. Name this database, for example, "sitename_wiki2db". Add administrative users with full permissions. Tip: I keep a "template" wiki defined for this purpose. That template has my favorite features.

4. For subsequent wikis, duplicate the LocalSettings_wiki1.php file and edit fields, $wgDBname, $wgSitename, $wgLogo, $wgArticlePath, as used. database, "sitename_wiki1db", replacing "wiki1" with "wiki2", for example. Go into

5. I ran into a bug with the same cookie saved with two values having differing string lengths. One work around is to keep the codenames equal in length; another solution is to delete the cookie before defining it:

   setcookie("wikiCode", "");   # work around
   setcookie('wikiCode', $sr_WikiCode, time()+60*60*24*365, '/', '');

Steve's approach requires no initialization, and no access to executables nor consoles. Each wiki consists of a database and LocalSettings_nnnn.php file. Use of the database simplifies eventual porting, but also permits working from a template of basic features that you like.

How to have 3 wikis use the same user information, but otherwise have separate databases and files[edit]

I have three Wiki installs that are each separate, but on the same server. Their DBs are on the same mySQL server, but are in different databases. How do I make them all share the user information (and allow cross-site logins, so that if someone logs into site 1, they are also logged into site 2)? Can this be done by designating one user table as a master, and the others as views to that master? Any other possibilities?

How do I install more than one Wiki-Server with SSL on Windows? (March 2006)[edit]

  • Installed Mar 2006, W2K3-Server, Apache 2.0.54, PHP5.04 (xampp-win32-1.4.14), MediaWiki 1.5.6
Solution : Shared VirtualHost with SSL, one IP-Address, one SSL-Certificate 

  • 1. Install MediaWiki
e.g. 2 Wiki-Server, installed in real DocumentRoot, 
first in /DocumentRoot/wiki1 
second in /DocumentRoot/wiki2
  • 2. Rename index.php and add entries (alias, ...) to httpd.conf
Rename index.php e.g. in wiki1ix.php and wiki2ix.php
# GLOBAL AREA httpd.conf
# First Wiki-Server 
Alias /wikisrv1 /DocumentRoot/wiki1/wiki1ix.php
Alias /wiki1ix.php /DocumentRoot/wiki1/wiki1ix.php
# Alias for upload-area
Alias /uploads /DocumentRoot/wiki1/uploads
# Second Wiki-Server 
Alias /wikisrv2 /DocumentRoot/wiki1/wiki2ix.php
Alias /wiki2ix.php /DocumentRoot/wiki2/wiki2ix.php
# Alias for upload-area
Alias /uploads /DocumentRoot/wiki2/uploads
   ServerAdmin ...
   # Real DocumentRoot !
   DocumentRoot "/DocumentRoot"
   ErrorLog ...
   CustomLog ...
   # Wiki-Server 
   DirectoryIndex wiki1ix.php wiki2ix.php
   AccessFileName .htaccess
   ScriptAlias /php/ "/xampp/php/"
   Action application/x-httpd-php "/php/php.exe"
  • 3. Settings in LocalSettings.php
$IP = "/DocumentRoot/wiki1";
$wgScriptPath     = "/wiki1";
$wgScript           = "$wgScriptPath/wiki1ix.php";
$wgArticlePath = "/wikisrv1/$1";
(wiki2 too)
  • 4. Settings in .htaccess /DocumentRoot/wiki1
# RewriteRule SSL
RewriteEngine On
RewriteRule ^/$ /wiki1ix.php
RewriteCond %{SERVER_PORT} !443$
RewriteRule ^(.*)$1 [R=301,L]
(wiki2 too)
  • 5. Optional Settings in .htaccess /DocumentRoot
# deny access to Root Directory, rewrite to another virtual host 
RewriteEngine On
RewriteRule ^/$ /index.html
RewriteRule ^(.*)
# if Alias-Directory upload is indexed, rewrite home-link back to wiki-server
RewriteCond %{HTTP_REFERER}
RewriteRule ^(.*)

Can I import from other types of wiki?[edit]

There is some documentation about importing in the UPGRADE file distributed with MediaWiki.

To follow on from those, this is how at least one individual imported pages from usemod to MediaWiki:

Because MediaWiki does not automatically link to CamelCase style links, you will need to add brackets [[ ]] to all your links. You can do this with the following:

First, obtain ImportStage1.txt (or whatever you want to call it) from the importUseModWiki.php script ( use > to pipe the output to a file )

Second, do

sed '/Importing/!s/\ [A-Z]\w*[a-z]\w*[A-Z]\w*[a-zA-Z]/\ \[\[&\]\] /g'
    ImportStage1.txt > ImportStage2.txt

This should create proper links in place of your CamelCase links.

This doesn't work so well for SubPage links - someone care to fix?


sed 's/upload\:\w*\.\w*/http\:\/\/aberwiki\.org\/uploads\/& /g'
    ImportStage2.txt > ImportStage3.txt

This fixes your upload links. Change the replace text so it fills in your url such as

You are now ready to import ImportStage3.txt into your database with a command such as

mysql -u<mysqluser> -p<yourpass> <db name> < ImportStage3.txt

Note: If your importUseModWiki.php outputs an XML file instead of SQL statements, this probably means you have a rather new version of MediaWiki. In such a case, you case import the XML file -- see Importing a Wikipedia database dump into MediaWiki, towards the bottom of the page ('Import XML'). Don't forget to rebuild all the tables -- that page also explains how to do that.

Is it possible to define a database prefix?[edit]

It is not possible in versions 1.3.x and prior.

In versions 1.4 and later it is possible to configure a database prefix during the install process. It is a good practice to add an _ after the prefix otherwise all the tables will look really clumsy.

Why is the Help: namespace empty?[edit]

We don't currently have a clean, generic, internationalized set of help pages. Would you like to write one? However, you will find some useful pages in the MediaWiki User's Guide. They are of course open content under the GNU FDL.

I've changed $wgLanguageCode to something else, but nothing happens - what gives?[edit]

MediaWiki will look for interface text in a special namespace, MediaWiki. These messages can be viewed through Special:Allmessages. Changes to $wgLanguageCode post-install will not be reflected in the interface using the default configuration.

To permit the changes to take effect, either:

  • Run the rebuildMessages.php script from the command line in /maintenance folder
php rebuildMessages.php --rebuild


Note: Using the second option will disable the MediaWiki namespace for the purposes of customizing the interface, including items such as the sidebar.

Note 2: The language settings are also influenced by the user's preferences at Special:Preferences. If you change the language of your wiki, it is possible the old messages still appear because your "Language" field at the user-preferences is still set at the old language. -- Wilinckx 17:05, 10 March 2006 (UTC)

What if I can't run rebuild Messages.php from the command line?[edit]

If you don't have access to a shell/command line (usually the case with third party hosting services) then you may find you can use Martin Geisler's phpShell software to achieve the desired result (unless SAFE MODE is not set for php).

For more information, visit

The install stops with no messages or I get a blank page![edit]

Installation problems are sometimes weird and hard to diagnose. If possible, check PHP's error log (you may have to configure PHP to enable error logging) and report any error messages you have and the complete output from the installation script to mediawiki-l, we'll see if we can hash it out.

If you can track down the problem specifically, please report it directly to

Known issues

  • Version 1.3.3: you'll get a blank page after submitting configuration info on your config/index.php script if you don't make the config directory writeable.
  • Version 1.3.x: bugzilla:736

I want my wiki to appear in a frame as part of my site, but it keeps popping out of the frame[edit]

MediaWiki contains protection against abusive use of frame sets. Unfortunately this will trap your intentional frames as well -- to remove this, edit LocalSetting.php and set $wgEditPageFrameOptions='SAMEORIGIN';

Solution was found in includes/DefaultSettings.php, possible values for this parameter are also well documented (DENY|SAMEORIGIN|false)

How do I change messages of the user interface?[edit]

The user interface text is put into pages in the special MediaWiki namespace. When logged in as a sysop, you can edit those pages to immediately change the output of the wiki.

Some configuration changes (like changing $wgSitename to set the wiki's name) don't affect the pages which were generated at install time. You can edit them directly, or use the "rebuildMessages.php" script in the maintenance directory (it must be run from the command line and you must set up an AdminSettings.php file). See MediaWiki localisation.

Why doesn't my wiki work on Sourceforge?[edit]

See Running MediaWiki on

How do I install Imagemagick for Thumbnails on Windows?[edit]

With the following installed on the server, it should work:

  • php.ini
  • Localsettings.php
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert"; #<-- this should point on the right path 

If its in the windows path variable, you can use "convert" only

Using ImageMagick-6.2.5-Q16-windows-dll:

  • Install ImageMagick. Make sure the installation directory does not contain any blank spaces.
  • LocalSettings.php
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert";  # <-- this should point on the right path
  • You don't have to add php_imagick.dll to your php.ini
  • If you are running php in safe mode, add the ImageMagick installation directory to your php.ini: e.g safe_mode_exec_dir=C:/Programs/ImageMagick.
  • Also you will have to change permissions for %systemroot%/system32/cmd.exe. Grant read and execute rights to IUSR_XXX and IWAM_XXX.

Using ImageMagick-6.3.3-Q8:

  • I installed the DLL version on our server.
  • In LocalSetting.php
    • I set $wgUseImageMagick = true;
    • I set $wgImageMagickConvertCommand = "The appropriate file path" (in quotes) WITH spaces.
  • Everything worked fine.

How do I install Imagemagick for Thumbnails on Windows? (March 2006)[edit]

  • Installed Mar 2006, W2K3-Server, Apache 2.0.54, PHP5.04 (xampp-win32-1.4.14), MediaWiki 1.5.6
  • 1. Installation - ImageMagick
- Download from 
- or look at
- DLL-version ImageMagick-6.2.6-1-Q8-windows-dll.exe 
- e.g. install in e:\usr\bin\sysexec (do not use any space in the install path)
  (no 'Program Files' allowed nor 'progra~1')
- set PATH to e:\usr\bin\sysexec (normally, this is automatically done during installation)
  • 2. Environment - LocalSettings.php :
NOT THIS FOR $IP : $IP = "E:\\xampp\\htdocs\\mediawiki"; 
MUST BE WITH SLASH : $IP = "/xampp/htdocs/mediawiki";
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert.exe";
  • 3. PHP safe_mode - httpd.conf (global or virtual host)
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value safe_mode_exec_dir /usr/bin/sysexec
  • 4. Modify MediaWiki-PHP-Script includes/Image.php
function reallyRenderThumb( $thumbPath, $width, $height ) {
-REMOVE // wfEscapeShellArg( $this->imagePath ),
+ADD ( $this->imagePath ),
-REMOVE // wfEscapeShellArg( $thumbPath ) ),
+ADD ( $thumbPath ) ),
-REMOVE // $conv = shell_exec( $cmd );
+ADD // php safe_mode on - set shell_exec to exec
+ADD $conv = exec( $cmd );
-REMOVE // wfEscapeShellArg($this->imagePath) . " " .
+ADD ($this->imagePath) . " " .
-REMOVE // wfEscapeShellArg($thumbPath);
+ADD ($thumbPath);
-REMOVE // $conv = shell_exec( $cmd );
+ADD         // php safe_mode on - set shell_exec to exec
+ADD         $conv = exec( $cmd );

The index redirects to localhost or or just times out[edit]

When constructing full URLs and HTTP redirects, MediaWiki uses the hostname provided by the web server. Under Apache this will usually be specified by the ServerName directive if not autodetected from the system.

If that is set wrong, you should do one of the following:

  • Set the ServerName directive in Apache to the proper hostname
  • Override $wgServer in LocalSettings.php with the URL protocol and hostname (eg '')

How do I rename a page and all (some) of the links to it?[edit]

Pages may be renamed by any logged-in user, in the standard configuration. Using the "move" tab (in monobook skin) a user may enter a new name for a page. A radio-box will allow the talk page to be moved simultaneously to the new talk page. This will also create a redirect to the new name at the old page name.

It's important to check the [[Special:Whatlinkshere]] at the new page name to check for broken redirects and links. Any link which has more than one redirect will "break", leaving the browser looking at the wrong page.

How do I add a table of contents?[edit]

A TOC is added automatically as soon as you have more than three headers. To add one with fewer than four headers, type __FORCETOC__ anywhere on the page or __TOC__ at the position where you want to have the TOC.

How do I hide a table of contents?[edit]

To remove a table of contents from a page, add __NOTOC__ to anywhere on the page. The __ character before the commands is two _ characters together. See Manual:FAQ#How can I hide the table of contents? for other options.

MediaWiki is slow, how can I make it faster?[edit]

  • First you should try installing a free PHP cache engine such as eAccelerator or APC (after installing, modify your $wgMainCacheType accordingly). The engine will save the parsed PHP scripts and enhance performance a lot (this is something you should use anyway on any PHP installation with non-trivial traffic). Zend Server (commercial) and Zend Server CE (free) also contains a bytecode cache, however its "dynamic content caching" is not supported in MediaWiki at the current time.
  • Use Squid, Varnish or MediaWiki's native file cache ($wgUseFileCache = true) to cache whole pages
  • Memcached will provide some performance benefit, especially for heavily viewed sites. See also the cache section of the configuration settings.
  • See the Reduction section of the configuration setting.
  • See the $wgUseDatabaseMessages setting.
  • Switching the MySQL table type to MyISAM may be faster for single-user wikis on lower-end computers. See also: MySQL Storage Comparison.
  • Disable ImageMagick in LocalSettings.php $wgUseImageMagick, though this will cause reduced thumbnail quality. ImageMagick imposes a performance penalty during various page views and edits and can slow down bulk uploads.
  • For a heavy concurrent write load, InnoDB is essential. Set $wgAntiLockFlags = ALF_NO_LINK_LOCK | ALF_NO_BLOCK_LOCK to reduce lock contention, at the expense of introducing occasional inconsistencies. Use memcached not the default MySQL-based object cache.
  • If using Squid, enable HTCP and add $wgHTCPMulticastAddress
  • If you have $wgReadOnly set, check bug 11533.

Can I print out my entire MediaWiki site?[edit]

Go to PDF Export, export your whole site into one PDF file and print that. Requires HTMLDOC. Note that (currently) this will not work for unicode content eg Chinese.

What is the print-friendly url?[edit]

Normally the print stylesheet is attached so it is automatically used when printing -- just printing or print-previewing a wiki page will demonstrate this.

You can force a print friendly view. For example:

Can I use in my installed version of mediawiki?[edit]

Yes, see mw:Manual:$wgForeignFileRepos, although this is discouraged.

If I start my own commons wiki, how do I set it up, so that my other wikis can use its media?[edit]

Have a look at mw:Help:Configuration settings#Shared_uploads or Help:Wiki family for detailed information --Produnis 09:50, 16 April 2006 (UTC)

How do I run a bot?[edit]

You might want to use the python wikipediabot.

How do I completely disable caching?[edit]

Add in your LocalSettings.php file the following lines:

$wgEnableParserCache = false;
$wgCachePages = false;

How do I purge cached pages?[edit]

  1. You can use ?action=purge on individual pages to update their cache dates.
  2. There is a global $wgCacheEpoch variable which can be set in LocalSettings.php to invalidate all prior cache entries (see DefaultSettings.php)
  3. If you want to purge all pages in the parser cache, truncate objectcache table from the wiki database. You may use this command:
    TRUNCATE TABLE objectcache;
    Hint: If this fails, you might be using a prefix for your database tables!
  4. A shell script such as this may be used
#! /bin/bash
# mwpurgecache - invalidate mediawiki cache

set -e

PROG=$(basename $0)

function version() {
 echo "$PROG $VER - invalidate mediawiki cache
Copyright (c) 2005 Claudio Jolowicz <>

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This programs comes with

function usage() {
 echo "Syntax: $PROG [options] [--] [pages]


 -H, --host          host name           (default: localhost)
 -w, --wiki WIKI     server path to wiki (default: /wiki/)
 -u, --user USER     username for HTTP authentication
 -p, --passwd PASS   password for HTTP authentication
 -d, --dryrun        show commands without executing them
 -q, --quiet         quiet (no output)
 -v, --verbose       be verbose (print server response)
 -h, --help          display this message
 -V, --version       display version information

Options and arguments must be separated by whitespace.  WIKI must
match wgArticlePath, such that \$wgArticlePath = \"WIKI/\$1\". WIKI
must not contain regex special characters.

This script requests all wiki pages listed on the command line by
HTTP, prefixed by the wiki path, appending \`?action=purge' to the
URL. If no pages are specified, it retrieves the list of all pages
from Special:Allpages.


 \$ $PROG Main_page Help:Contents
 \$ $PROG -H -w /mediawiki -u joe -p banana
 \$ $PROG -H --dryrun | wc -l

## The '-e#' is a noop option to avoid `Unsupported scheme' errors.

while [ "$1" ]
 case "$1" in
   -H|--host) opt_host="$2"; shift;;
   -w|--wiki) opt_wiki="$2"; shift;;
   -u|--user) opt_user="$2"; shift;;
   -p|--passwd) opt_passwd="$2"; shift;;
   -d|--dryrun) opt_dryrun=true;;
   -q|--quiet) opt_quiet=true;;
   -v|--verbose) opt_verbose=true;;
   -h|--help) usage; exit 0;;
   -V|--version) version; exit 0;;
   --) shift; break;;
   -*) usage 2>&1; exit 1;;
   *) break;;
[ x"$opt_user" = x"" ] || user="--http-user=${opt_user}"
[ x"$opt_passwd" = x"" ] || passwd="--http-passwd=${opt_passwd}"
$opt_dryrun && run=echo
$opt_verbose && verbose="--server-response"
$opt_quiet && quiet="-q"
 if [ $# -eq 0 ]; then
   wget -qO- "$user" "$passwd" "${opt_host}${opt_wiki}Special:Allpages" |
   sed -re '/start content/,/end content/p' -e 's/href="([^"]+)"/\nGREPME:\1\n/g' |
   sed -nre 's/^GREPME:(.*)$/\1/p' |
   grep "^${opt_wiki}"
   for page; do echo "${opt_wiki}${page}"; done
) |
while read page
 $run wget -O/dev/null "$user" "$passwd" "$quiet" "$verbose" "${opt_host}${page}?action=purge"

exit 0

How do I organize pages into subdirectories like /wiki/subdir/PageName?[edit]

See Help:Link#Subpage_feature.

How do I make interlanguage links work, like they do on Wikipedia?[edit]

The interlanguage link feature on Wikipedia presents links in the sidebar when the user types text such as [[fr:Accueil]]. This feature is strongly biased towards a multi-wiki setup, with one language per wiki. It's not recommended for the case where multiple languages are contained on the same wiki.

If you're still sure you want to use it, here's how it works: a link such as [[xx:Pagename]] will be considered an interlanguage link if the following three conditions are satisfied:

  1. $wgInterwikiMagic is enabled (which it is by default)
  2. xx is listed as a language code in languages/Names.php (which most ISO 639-2 codes are)
  3. xx is listed as an interwiki prefix in the interwiki table of the wiki database.

To add an interwiki prefix, edit the interwiki table using your favourite MySQL administration tool, or run a query such as:

INSERT INTO (Site prefix)interwiki (iw_prefix,iw_url) VALUES ('xx', '$1');

If you want to have multiple languages on the same wiki, it's better to use templates and subpages, like we do on meta. See m:Wikimedia Foundation for an example of this.

Search returns no results for some words![edit]

MySQL's fulltext search engine has a default set of stop words which it ignores, and a minimum word length set to 4 characters by default.

To change this you must reconfigure MySQL, see:

However, this talks about MySQL generically, and not with regard to using it with MediaWiki.

So ... if you took all the defaults for your installation of the OS, MySQL and MetaWiki and have only a small database (i.e. just installed), here's how to go about getting three letter searches:

  • Firstly, if you already have a big wiki, the change can take a long time. The MySQL reference above has someone who did this for a 4Gb database and it took 10 days! So be careful. Now let's have a go.
  • The parameter to reset is inside MySQL, and as noted above is discussed on the MySQL web site. Go there for more details if you're into MySQL.
  • Find the config file for My SQL - this is normally my.cnf, located in /etc
  • Edit my.cnf and add the relevent parameter in this file (ft_min_word_len=3). This is normally set to 4 for performance reasons - 4 is the default and not in the my.cnf file when installed. Make sure this is put under the [mysqld] section of my.cnf
  • Restart MySql, using the Service Controller or stop and restart mysqld from the command line
  • Go into MySql (mysql at the command line)
  • Issue the MySql command that you need to look at the wiki database (use wikidb;) - note that this may be different if you changed the default wiki database install schema with something like my_wikidb
  • Rebuild the search indexes by asking to repair the searchindex table. The command line to type is: repair table searchindex quick; an example is as follows showing what you should see:
mysql> repair table searchindex quick;
| Table              | Op     | Msg_type | Msg_text |
| wikidb.searchindex | repair | status   | OK       |
1 row in set (0.08 sec)</code>
  • Retest from your wiki server that you can see TLAs now - make sure you do have one in your wiki to find though otherwise you won't find it!
  • The above was performed on a Fedora Core 4 OS, server was a Compaq ML570. It should work ok for other distributions.

Important note

If you have upgraded mysql from v 3.xx in order to do the above, you must change the following parameter in your LocalSettings.php file in order for this to work.

From $wgDBmysql4 = false; To $wgDBmysql4 = true;

How can I recover the searchindex table?[edit]

First try REPAIR TABLE. See How to Repair Tables in the MySQL manual for more information.

If your searchindex table is broken beyond repair, you can run maintenance/rebuildtextindex.php from the command line to recreate it. Sorry, there's no web-based version of this at the current time. Instructions on executing from the commandline here and for allowing command line execution of php files here.

This fault occurred after a (old version) MediaWiki was hacked (text added fortunately not destroyed).

Can I insert data/template data from another wiki in realtime into my wiki page as my wiki page displays?[edit]

If I want to put info in my wiki from Wikipedia (eg a template such as below) without copying all the data, eg. templates, variables, images etc. etc. to my wiki can I just 'link' to the other wiki (eg. Wikipedia) in real time as my page loads?

This feature is in development. Check back when 1.6 comes out. -- Tim Starling 07:27, 1 February 2006 (UTC)

Version 1.6 is out now, but I wonder where this feature has left or where is discribed how to use it? I'm very highly interested in it! Please help me! drundanibel 2006-05-22


I access the wiki pages on my system by writing http://localhost/directorypath. But, if I try writing http://systemname/directorypath, it throws an error that page not found.[edit]

"Localhost" means the machine you are on; it is not a real name, it's like a pronoun. You need to check two things: does your server have a name? and does the world know this name?

To find the first, in Linux, go to a system prompt and type the command "hostname". This will return the server's full name. If it doesn't have a name, you can set it (if you are logged in as root) with the command "hostname -v servername". And second, is the server known by this name on the network? Check with your system/network administrator to find out if the server is registered in the DNS (Domain Naming Sytem) for this domain. You can test this by using PING from a command line - if you can ping the server by IP address but not by name, then it is not in the DNS.

If both of those are correct, then ...

Maybe there is something wrong with your Apache virtual hosts? See the Apache documentation for details.

If you use EasyPHP, your Apache config file will have a line: "#Listen". Just add another line below: #Listen <name or IP>:80" and it works.

How do I change the look and feel of MediaWiki for my own site?[edit]

See MediaWiki look and feel for a detailed explanation.

I have lost my skin after upgrading![edit]

Clear your browser cache and reload the page.

How can I disable/enable tabs at top (monobook), add history navigation to article pages, or otherwise move around functional components from page to page?[edit]

Under 1.5, to disable all view top tabs, create a new skin according to the instructions in MediaWiki look and feel#Skin and name this MonoBookNoViews. Set this as the default theme. Logged in users will need to change their default theme to see the tabs to edit pages, however.

You will need to remove the section of code in the MonoBookNoViews.php file which generates the views (top tabs).

Search for this code:

      <div id="column-one">
 <div id="p-cactions" class="portlet">
   <h5><?php $this->msg('views') ?></h5>
     <?php foreach($this->data['content_actions'] as $key => $action) {
        ?><li id="ca-<?php echo htmlspecialchars($key) ?>"
        <?php if($action['class'])
                 { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
        ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
        echo htmlspecialchars($action['text']) ?></a></li><?php
      } ?>
 <div class="portlet" id="p-personal">

online users counter script Replace it with this:

      <div id="column-one">
 <div class="portlet" id="p-personal">

To remove the "Edit" links in the content sections, modify monobooknoviews/main.css.

Replace this line: (Please note that this will only work for IE browsers - all others will still display the Edit link next to a section)

* html div.editsection { font-size: smaller; }

With this line:

* html div.editsection { display: none !important; }

How do I change the default skin for users that are not logged in?[edit]

Set $wgDefaultSkin = 'monobook'; in LocalSettings.php (see example). Make sure that the quoted skin is in lowercase in the LocalSettings.php file (ie: 'monobook', not 'MonoBook') regardless of how the skin name is actually capitalized.

I've changed settings in LocalSettings.php, such as $wgSitename, but they don't show up in my browser. Why not?[edit]

(Note: As always, first ensure that you're not viewing a cached page - perform a "hard refresh", clear the browser cache, or view a page that didn't exist before the change.)

There was a bug in versions of MediaWiki prior to 1.3.6 where variables, such as $wgSitename, were interpolated into user interface messages at install, rather than when the message was requested (Bugzilla:296). The result was that any later changes to these variables would have no effect on these messages, since the software simply saw them as plain text; all UI messages can be reset to their defaults (with the new variable values) by running the maintenance/rebuildMessages.php script. If you upgrade to the latest version of MediaWiki first, these will include dynamic references to the variables (e.g. {{SITENAME}}) and should therefore reflect future configuration changes.

Some language files incorrectly set $wgSitename to a local transliteration of "Wikipedia". If this happens, you need to edit the language file, at languages/Language??.php. Search for the $wgSitename and remove the lines where it is set. If you find a problem like this in the most recent version of MediaWiki, you should report it at bugzilla.

Does MediaWiki automatically capitalize the first letter of $wgSitename?[edit]

Yes. This can be changed using the $wgCapitalLinks configuration setting.

How do I change which page is the "Main Page"?[edit]

Visit the "MediaWiki:Mainpage" page, enter the name of the new default page, and save changes. MediaWiki should recognize the setting and use the new default page.

How can I change what the <title> of each page is? Where do I make changes?[edit]

Most of the text that you want to change, can be found in the namespace of MediaWiki.

In order to change titles, texts, announcements and the like, go to Special:Allmessages, where you will see the text associated with the pages you wish to change. (As far as I can tell, you need to log in as an administrator (like the one you made when you installed) to edit the protected entries in the MediaWiki namespace.)

If you want to change the title in your browser, you need to edit MediaWiki:pagetitle. Go there and edit it just like you would any other page in your Wiki.

In recent versions of MediaWiki, MediaWiki:pagetitle is $1 - {{SITENAME}} by default. If {{SITENAME}} is producing the wrong text for you, you need to set $wgSitename in your LocalSettings.php.

If $wgSitename is correct in LocalSettings.php but {{SITENAME}} is still wrong, it may be that you're using a user-contributed language file which incorrectly sets $wgSitename to a transliteration of "Wikipedia". Edit the language file to correct this. For example, the hebrew language file is at languages/LanguageHe.php in your wiki directory.

Don't forget to clear your browser cache after you fix it.

How do I enable uploads?[edit]

If you get the following message:

Sorry, uploading is disabled.

See For more information and trouble shooting, see Uploading files.

When I try to upload files in Mediawiki 1.5 I always get a "The file is corrupt or has an incorrect extension. Please check the file and upload again." error.[edit]

With 1.5, first check whether the mediawiki temp dir exists and has the right permissions. In general, check your php- and mediawiki-logs for any obvious errors.

After, try in the maintenance directory to rebuildImages and then, display the pages with a trailing ?action=purge.

This may happen if MediaWiki fails to determine the correct MIME-Type for the file you are uploading. For images, this should always work if your PHP has the GD extension enabled. For other files, the file_info or mimemagic extensions can be used (make sure they are configured correctly if present). Alternatively, use an external program for mime detection, by settings wgMimeDetectorCommand to the desired command.

Under linux, you can use the following in LocalSettings.php:

$wgMimeDetectorCommand= "file -bi"; #use external mime detector (linux)

to your LocalSettings.php file solves this problem in some cases.

If all else fails, you should be able to solve this by adding

$wgVerifyMimeType = false;

to your LocalSettings.php file. Note that this will turn off most sanity checks on the file - this is a security hazard.

The file command did not work for me under Fedora Core 4. It turns out that SELinux was preventing the php script from running file on uploaded files. I had to disable SELinux for httpd [1] to get uploading and mime typing to work correctly. 16:02, 25 February 2006 (UTC)

This problem occurred for me when trying to upload .doc files that were saved in MS Word 2007. Works fine with docs saved from Word 2003. MediaWiki Version 1.14.0. 16:17, 24 November 2009 (UTC).

When I try to upload bigger files in Mediawiki 1.5 I always get "Internal error! couldn't move "/tmp/somefile" to "/wikidir/images/temp/filename"[edit]

On top of the screen you should see a PHP-error aswell saying something like this:

Warning: move_uploaded_file():
 Unable to access /temp/somefile in /wikidir/includes/SpecialUpload.php on line 370

The most common reason for this is that upload_max_filesize in php.ini is set to the default of 8MB, and you want to upload a file that is larger. See this section of the PHP manual for more PHP-related problems. Be careful that you're editing the right php.ini -- PHP is well known for its decoy configuration files. Create a .php file with nothing but <?php phpinfo() ?> to inspect your configuration settings.

Another way to fix this could be to go to the /images folder and there to manually create two folders: /temp and /thumb Apparently they were not included in my distribution

One user has reported that setting $wgUploadSizeWarning to a large number in LocalSettings.php fixed this problem for them.

  • Try this:

(1) Create a blank php.ini file and place it in your wiki root directory.
(2) Add to that file this line: upload_max_filesize = 25M (or whatever max size you want)

It worked for me -- User:WikiDontLoseThatNumber

(traslate this, please. I speak Spanish): En una Wiki corriendo sobre Windows corregí este error dando permisos de lectura/escritura al directorio donde está instalado el php (c:\php) y al directorio en donde está la wiki. O sea que es un problema de permisos de las carpetas compartidas.

In a Wiki running on windows I fixed this by adding writing/reading permissions to the directory where php is installed (c:\php) and the directory where the wiki is. That probably means the problem is related to shared directories permissions.

How do I use templates?[edit]

See Help:Templates.

How do I set the timezone for my MediaWiki?[edit]

There are two timezone-related settings: $wgLocaltimezone and $wgLocalTZoffset. Set both in LocalSettings.php. $wgLocaltimezone is used for formatting the timezone in signatures, and should be set to the locale name, for example "Europe/Berlin". $wgLocalTZoffset sets the default user preference the number of hours your local time differs from server time, and is used for timestamps seen in recent changes and history views. $wgLocalTZoffset should be set in minutes, for example, "-480" equals 8 hours behind the server time.

How does DST (Daylight Savings Time) work with MediaWiki?[edit]

This is dependent on the server, as the MediaWiki gets the date from the server's timestamp.

How do I make my base URLs shorter?[edit]

See eliminating index.php from the url for details. You may need access to server files like httpd.conf.

How do I enable PHP to be processed in a page rather than displayed?[edit]

How do I activate HTML-Tags, e.g. "<input>" or "<form>" ?[edit]

It seems to be possible to activate HTML-Tags like "<input>" or "<form>" (Have a look at [2], and note the PayPal Buttons working). How does it work ?

  1. if you need those HTML-tags for one action only (e.g. this PayPal-Button), but don't want HTML to be activated generally, write your own MediaWiki_Extension which outputs your HTML-needs (e.g. PayPal extension).
  2. the more "dirty"-way is to add $wgRawHtml = true; to your LocalSettings.php. If you do so, HTML-tags are activated on every page.

Note: even after adding $wgRawHtml = true;, it appears you must surround your html tags with <html> and </html>. XHTML compliance requires ALL tags to be enclosed.

How do I make $wgRawHtml = true; work only with sysop user and not with other users?[edit]

See How do I make it so only admins can add full html codes to articles?

How do I make it so only admins can add full html codes to articles?[edit]

You can't. Due to the way a wiki works, it's all or nothing. But with a bit of work, one can tweak things so that the HTML code will only be executed if the page is protected, thus effectively giving whoever has the protection privilege the necessary control.

How do I make external links pop up in new browser windows?[edit]

Opening external links in a new window

Why are embedded images not displayed, not even in their image description pages?[edit]

  • This problem is often caused by a missing MIME type in image fields. Try running the maintenance/rebuildImages.php maintenance script from the command line. Rob Church Talk 17:10, 8 February 2006 (UTC)
  • If that still doesn't work, check whether the magic file used for MIME detection (e.g. /etc/httpd/conf/magic) knows about PNG. If not, adding the following line in the image section will fix it:
0       string          \x89PNG         image/png
  • I'm not sure if this will help any of you, but if you're using a subdomain with hotlink protection, add your subdomain to the list of allowed linkers. After days of installing and reinstalling MediaWiki, then trying another one, I finally realized that it was the subdomain issue.

How do I enable the "Printable version" option when using MonoBook skin?[edit]

How do I disable external links from showing in the printable version of a page?[edit]

Can somebody help me deactivate this? When I try to print all the tables become too wide.

I was able to prevent external links from displaying by commenting out the section "// Expand links for printing" in file skins\common\IEFixes.js.

The above solution works, but only in IE. I can't find another reference to "Expand links for printing" in the code.

It would be ideal to have all the links referenced in the text with a number and have the full links listed at the bottom of the page.

Added 12-2010

To prevent external links from displaying in a printable version, it is unnecessary to modify the skins/common/IEFixes.js JS code. Just modify the CSS file in skins/common/commonPrint.css and comment the section #content a.external.text:after, #content a.external.autonumber:after

#content a.external.text:after, #content a.external.autonumber:after {
   /* Expand URLs for printing */
   content: " (" attr(href) ") ";

How do I change default user preferences?[edit]

The following applies to MediaWiki 1.4 and later.

The MediaWiki default user preferences are in the language file, i.e. languages/Language.php if you're using English. Don't edit that file, just use it for reference, like you do with DefaultSettings.php.

Say if you want to change the default number of search results on a page. Language.php says:

/* private */ $wgDefaultUserOptionsEn = array(
       'searchlimit'  => 20,

To change it to 50, put this in your LocalSettings.php:

$wgDefaultUserOptions = array( 'searchlimit' => 50 );

Note that you are setting $wgDefaultUserOptions, which contains the site overrides, not $wgDefaultUserOptionsEn, which contains the software defaults. Any settings in $wgDefaultUserOptions will override those set in the language file.

This override mechanism was introduced in MediaWiki 1.4, before then, you had to change the language file. Because this was very inconvenient, two special-case overrides were introduced before the current general override system was developed.

To change the default skin, in any version of MediaWiki, set $wgDefaultSkin in LocalSettings.php to the lowercase name of the skin.

To change the default namespaces to be searched, in any version of MediaWiki, set $wgNamespacesToBeSearchedDefault in LocalSettings.php to an array mapping namespace indexes to boolean values. For example, to search the main namespace and the category namespace, use:

$wgNamespacesToBeSearchedDefault = array(
    NS_MAIN => true,
    NS_CATEGORY => true,

In some cases, after you change a default user preference, you may also want to change the user preferences of all existing user accounts. This requires some database hacking. To continue the previous two examples, to change the number of search results, run the following query:

UPDATE user SET user_options = REPLACE(user_options, 'searchlimit=20', 'searchlimit=50');

To search categories by default, use:

UPDATE user SET user_options = REPLACE(user_options, 'searchNs14=0', 'searchNs14=1');

14 is the index of the category namespace. See Help:Namespace for a list.

If you are looking to change this option for all users, I recommend using the userOptions.php script in the Maintenance directory. I use the "--dry" option for the first run, asses the impact and go from there. (--dry does not write the the database)

php userOptions.php --dry --nowarn enotifusertalkpages --old 0 --new 1

Also, always backup your database before attempting these kinds of changes. Thomsonj 14:39, 5 December 2008 (UTC)

Is there a way to easily install all Help Documentation after a mediawiki installation?[edit]

There is a project at mw:Project:PD help that is creating a self-contained help system, with links to an experimental pywikipedia bot that can mirror that.

I can login but I get a message about disabled cookies (and they're not!)[edit]

Mediawiki has problems with autostarting sessions. Check your php.ini (you can run phpinfo() to find where it is located) and look for session.auto_start. It should be '0'. Also, session.use_cookies should be '1'. If you don't have access to php.ini and you're using Apache try to create a .htaccess file with the following content:

php_value session.auto_start 0
php_value session.use_cookies 1

I still have the problem even after doing all of that.

If you still have a problem after disabling session.auto_start and enabling session.use_cookies in PHP, try commenting out the check function in mediawiki/includes/SpecialUserlogin.php:

        function onCookieRedirectCheck( $type ) {
                global $wgUser;

/*              if ( !$this->hasSessionCookie() ) {
                        if ( $type == 'new' ) {
                                return $this->mainLoginForm( wfMsg( 'nocookiesnew' ) );
                        } else if ( $type == 'login' ) {
                                return $this->mainLoginForm( wfMsg( 'nocookieslogin' ) );
                        } else {
                                # shouldn't happen
                                return $this->mainLoginForm( wfMsg( 'error' ) );
                } else {
*/                      return $this->successfulLogin( wfMsg( 'loginsuccess', $wgUser->getName() ) );
//              }

How do I make it go straight to editing the new topic if the topic is not found in a search?[edit]

Set the following in LocalSettings.php:

$wgGoToEdit = true;

Be warned that this will greatly limit your ability to display search results.

More complex customization[edit]

How do I change noindex nofollow[edit]


$wgNoFollowLinks = false;

in LocalSettings.php

How do I use Oversight?/delete revisions in the page history?[edit]

You have a choice. You can use RevisionDelete, or you can use Extension:Oversight. You can also delete a page, and then restore only the revisions you want.

One difference here is that you do not need access to the command line or database to use RevisionDelete

How do I use a signature longer than what will fit in preferences?[edit]

See How do I use a template as a signature?

How do I use a template as a signature?[edit]

When you look at your preferences, you see a check box for "raw signature." But the field will only take a certain number of characters. What if you want more?

You will need to create two pages, possibly in your userspace.

  1. Create the first page (FIRST PAGE)
  2. Go to your preferences, check "raw signature" and put {{FIRST PAGE}} in the signature. Save
  3. Create a second page (SECOND PAGE) (possibly a sub-page of the first)
  4. Go back to the first page (FIRST PAGE) and do {{SECOND PAGE}}
  5. Go to the second page (SECOND PAGE) and place the code you wish to have for your signature.

If you don't have this structure, you will still be inserting all your signature code into the raw code wherever your signature is used, because the software will insert "SUBST" in your preferences. You may not mind this, in which case you only need one page. If you want the raw code to only display {{FIRST PAGE}}, which looks a lot cleaner, then you need to use the two-page structure.

How can I create a dynamic php link in the skin to link to the talk page for each corresponding page?[edit]

I have it setup for the edit page like this

<a href="<?php global $wgTitle; $pagename = $wgTitle->getFullUrl('action=edit'); echo($pagename); ?>">Edit this page</a>

I can't seem to have it properly setup for the talk page however.

Simple Category Automation[edit]

We all like to keep our wikis tidy. This is a little system that shows every user what to copy and paste into their pages to include it in the right category.

  1. Create a new template by visiting
  2. Paste the following into it and save:
[[Image:catalert.png]] '''Please copy and paste the following into the end
 of your article to include it in this category:'''
  1. Upload the alert image File:Catalert.png to your wiki.
  2. On every category page, simply paste the following:

How do I add the sandbox functionality to my installation of the wiki?[edit]

In wiki terms, a sandbox is simply a "play pen"; a page which users can mess about in. This is an ordinary page created in the normal manner, and can be located wherever you like. There is no special sandbox functionality built into MediaWiki.

Users often inquire about the Wikipedia sandboxes, which seem to be self-emptying. This is not quite correct; there are a number of volunteers who run bots to clean these up and return them to a certain state at regular time intervals.

How do I change the logo?[edit]

In your LocalSettings.php add:

$wgLogo = '/path/to/your/logo.png';

Default is skins/common/images/wiki.png

Please note that the path has to start with your www-root-directory not your operating-system-root-directory.

Default logo size is 135px by 135px

How do I show a link to create a page when searches fail?[edit]

First you need to go to the "special pages" link. Then click on "All system messages". Find and click on "nogomatch". click on "Edit this page". replace the existing text with the following:

Place wikitext similar to the following in MediaWiki:Nogomatch:

There is no page called $1. You can [[$1|create this page]].

This will create a regular "redlink" in the search results page, leading to the edit page. Your users can then create the page as usual.

Edit the file: Language.php, which locates the directory of languages.

How do I change the icon (favicon) in browser's address-line?[edit]

If you want to have another favicon,

  • you can change it in /includes/Skin.php file. Change the line from 'href' => $wgFavicon to 'href' => '/path/to/your/favicon.ico'.


  • you can simply replace the favicon.ico image file at the root of your wiki with whatever .ico image file you want.
  • in MediaWiki 1.6.3 there is a variable in /includes/DefaultSettings.php that can be overloaded in LocalSettings.php$wgFavicon = /path/to/your/favicon.ico (See mw:Manual:$wgFavicon)

The wiki will output a <link> which references the traditional /favicon.ico, at the root URL path of your site. (Some browsers will look there even without the <link>, others require it.)

Is it somehow possible to use a "file" URI-qualifier for local intranets e.g. [file://localhost/C: C-Drive]?[edit]

To allow links to local files (which may make sense in an intranet context), put this into your LocalSettings.php:

$wgUrlProtocols[] = "file://";

If you'd like to mark links to your file-system with an icon, you can add following code to your [[MediaWiki:Common.css]] page:

#bodyContent a[href ^="file://"] {
	background: url(document.png) center right no-repeat;
	padding-right: 12px;

Note, however, that some browsers, like Mozilla FireFox, will not follow file-URLs on pages that were loaded via HTTP:

Browser Supports file: links?
Internet Explorer 7.0 (Windows XP SP2) yes
Internet Explorer 6.0 (Windows XP SP1 or SP2) no
Internet Explorer 6.0 (Windows XP Professional Version 2002 SP1) yes
Internet Explorer 6.0 (Windows 2000 SP 4) yes
Internet Explorer 5.5 (Windows 2000 SP 4) yes
Netscape 7.0 (Windows XP SP1 or SP2) no
Opera Version 7.54 Final (Linux) no
Opera Version 8 (Windows) no (2)
Mozilla 1.7 (Linux) no /yes (1)
Firefox 1.0.x (Windows) no / yes (1)
Firefox 1.5.x (Windows) no / yes (4)
Konqueror (Linux) yes (3)
Safari 3.0.4 (Windows) yes

Getting Firefox to open file:/// links[edit]

Was listed as bugzilla:614 (RESOLVED WONTFIX).

(1) Enable user_pref("security.checkloaduri", false);, see below. Drag of link and drop into location bar does not work, in difference to Copy link / Paste link.

(2) Drag of link and drop into location bar works fine.

(3) Konqueror displays a warning if a remote (eg. http) URL points to a local (file, telnet, irc, whatever), and allows the user to cancel. ((Wikipedia User JensBenecke))

(4) Enable in the user.js (is not diplayed in about:config) user_pref("capability.policy.policynames", "localfilelinks");, user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess"); and the sites name for the access user_pref("capability.policy.localfilelinks.sites", "");. The attribute of capability.policy.localfilelinks.sites can contain several web pages separated with blanks.

Links to local pages don't work - MozillaZine Knowledge Base
A note: According to the Instiki FAQ loading of local file links from http links can be enabled on Mozilla and Firefox by putting user_pref("security.checkloaduri", false); into the file user.js.
It should also be possible to set this with the "about:config" interface (just type about:config in the address bar, typing into the filter input line then narrows down the displayed options to this one). I'm not sure which version of Mozilla introduced this (I just learned about this interface today).
However note that this setting is global, i.e. it will affect all sites you browse; while I don't know exactly what the security risk of this is, the fact that the setting is in the security section (and the note "If you don’t give a wit about the security of your local files" on the Instiki FAQ) strongly implies this is a security risk. -- 08:08, 29 Oct 2004 (UTC)
Perhaps if this is set, a malicious website could load a file:/// url into a frame, and read the contents with javascript? Could be a security risk if the right file was opened. -- 08:43, 10 May 2005 (UTC)

-- 13:32, 22 September 2005 (UTC) :

How do I add my own dynamic content to MediaWiki?[edit]

Write an extension that implements a special page. See Writing a new special page.

How can I insert one of my PHP functions underneath the "Search" box?[edit]

Dan Kohn has a neat tutorial

How do I put MediaWiki into Read Only mode?[edit]

Set $wgReadOnlyFile in LocalSettings.php (you need to put it below the DefaultSettings.php include or it will be overwritten) to the name of a file, then put the reason for read-only mode inside the file. The contents of the file will be displayed to anyone trying to edit the wiki.

Since 1.5 you can set $wgReadOnly to a string describing the reason for read-only mode, instead of creating a file. (Usual wiki markup is allowed in this string).

But even in this read-only mode some auxiliary fields in your database would be modified (for example, visit counters). If it isn't desirable see How do I completely lock my database?

How do I completely lock my database?[edit]

If you want to forbid really any modification of the database, you need to do this on the database itself (edit the permissions on your database to revoke UPDATE, INSERT, and DELETE operations from the wiki user, or put MySQL into read-only mode).

As a result the MediaWiki will not work properly: it will spew many SQL errors, but your database would not get tampered with. See also How do I put MediaWiki into Read Only mode?

By results of an experiment on MediaWiki 1.5.6, the minimal SQL rights for MediaWiki to work properly in read-only mode are:

GRANT INSERT, DELETE ON wikidb.objectcache TO user
GRANT UPDATE (ss_total_views) ON wikidb.wiki_site_stats TO user
GRANT UPDATE (page_counter) ON wikidb.wiki_page TO user

How do I move the location of the search box?[edit]

This is for the Monobook theme on version 1.5 only and involves modifying the Monobook.php file - you can see the effect here.

  • Find and select the following code in Monobook.php about line 223:


<div id="p-search" class="portlet">
   <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
   <div class="pBody">
     <form name="searchform" action="<?php $this->text('searchaction') ?>" id="searchform">
       <input id="searchInput" name="search" type="text"
         <?php if($this->haveMsg('accesskey-search')) {
           ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
         if( isset( $this->data['search'] ) ) {
           ?> value="<?php $this->text('search') ?>"<?php } ?> />
       <input type='submit' name="go" class="searchButton" id="searchGoButton"
         value="<?php $this->msg('go') ?>"
         /> <input type='submit' name="fulltext"
         value="<?php $this->msg('search') ?>" />
  • Move it either up or down in the page code, depending on where you want it positioned.
  • A good place to put the search box is just below the logo. To do this, move or copy the above code directly below where you find the following:
  <div class="portlet" id="p-logo">
   <a style="background-image: url(<?php $this->text('logopath') ?>);"
     href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
     title="<?php $this->msg('mainpage') ?>"></a>

How do I put an alphabetical list of links on the top of the category page?[edit]

First, you'll need to edit /wiki/includes/CategoryPage.php and find the instance method shortList of class CategoryPage. The first line of the function looks like :

  • The follow instructions do not work as given. Please clarify exactly. Thanks. 00:18, 24 April 2006 (UTC)
$r = "<h3>{$articles_start_char[0]}</h3>\n";

Replace it, adding an id attribute. The method becomes :

 function shortList( $articles, $articles_start_char ) 
 // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
 $r = "<h3

A more professional design could produce :

 function shortList( $articles, $articles_start_char ) 
     // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
     // !PATCH-ALPHA-CATEGORIES : // !SEE-ALSO $wgAlphaCategoriesPrefix in DefaultSettings.php
     global $wgAlphaCategoriesPrefix ;
     $wgAlphaCategoriesPrefix = isSet($wgAlphaCategoriesPrefix) ? $wgAlphaCategoriesPrefix : '' ;
     $szId = ($wgAlphaCategoriesPrefix === false) ? '' 
     : ($wgAlphaCategoriesPrefix." id=\"{$articles_start_char[0]}\" ") ;
     $r = "<h3 $szId >".$articles_start_char[0]."</h3>\n";

A few lines after, replace, in the same way, the following line:

$r .= "</ul><h3>{$articles_start_char[$index]}</h3>\n<ul>";

With :

     // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
     $r .= "</ul><h3 

Or, in a more professional design :

     // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
     $szId = ($wgAlphaCategoriesPrefix === false) ? '' 
        : ($wgAlphaCategoriesPrefix." id=\"{$articles_start_char[$index]}\" ") ;
     $r .= "</ul><h3 $szId >{$articles_start_char[$index]}</h3>\n<ul>";

Then, edit a Category page. Insert a line that looks like

 {{A-Z-title|Ma belle liste alphabétique}}

Of course, A-Z-title is just an example. You may use another template name.

Then, because A-Z-title is not yet defined, click on the link, edit, and enter a content such as :

<center>[[#A|A]] [[#B|B]] [[#C|C]] [[#D|D]] [[#E|E]] [[#F|F]] [[#G|G]] 
[[#H|H]] [[#I|I]] [[#J|J]] [[#K|K]] [[#L|L]] [[#M|M]] [[#N|N]] 
[[#O|O]] [[#P|P]] [[#Q|Q]] [[#R|R]] [[#S|S]] [[#T|T]] [[#U|U]] 
[[#V|V]] [[#W|W]] [[#X|X]] [[#Y|Y]] [[#Z|Z]]</center>

After reloading the Category page, your page will include something like :

Ma belle liste alphabétique


Later on, each time you want to add an alphabetic index to a Category page, simply reuse your A-Z-title :

 {{A-Z-title|Ma très belle liste alphabétique}}

Four related templates are available in this discussion page.

 {{A-Z-title|Ma belle liste}}
 {{A-Z-title-prefix|Ma belle liste|cp_}}

In a professional design, you should add in the /wiki/includes/DefaultSettings.php something like :

 // !PATCH-ALPHA-CATEGORIES : // !SEE-ALSO CategoryPage::shortList in CategoryPage.php
  * $wgAlphaCategoriesPrefix = false ; // disable feature
  * $wgAlphaCategoriesPrefix = '' ; // default
  * $wgAlphaCategoriesPrefix = 'myprefix_' ; // customized prefix
  $wgAlphaCategoriesPrefix = '' ;

In this case, you may eventually add, in your /wiki/LocalSettings.php something like

 $wgAlphaCategoriesPrefix = 'cp_' ;

In this case, you'll use one of these templates :

 {{A-Z-title-prefix|Ma belle liste|cp_}}
in this note, non-english (french, spanish, german, etc) expressions are voluntary used to denote examples,
PHP variable names such as $szId use hungarian prefixes,
patterns such as // !PATCH... are so-called haDoc comments, not to be confused with appropriate phpDoc comments.

How can I add a variable {{CURRENTWEEK}} for a "Featured article of the week" or similar?[edit]

Upgrade to 1.4 or later. Note that in PHP 4.4.1, PHP's week number function was changed to return a two-digit week number, with a leading zero for weeks less than 10. In MediaWiki 1.5.5 and later {{CURRENTWEEK}} will produce week numbers without a leading zero regardless of PHP version.

How do I change the contents of the navigation toolbar?[edit]

The solution is different between MediaWiki versions.

If the page doesn't change in the desired way after applying the changes, just point your browser to ''http://yoursite.tld/index.php/MainPage&action=purge''. Notice the "action=purge"-Part which clears the webpage cache.

Changing the files (php-installation-files)[edit]

General notes[edit]

Every link in the navigation box is specified in two parts - the text, and the target. Each of these is stored in an interface message; that is, a page in the MediaWiki namespace (in most situations, editting the LanguageXX.php files will have no effect on a running wiki).

  • if the content of the "target" message is a full URL (i.e. begins http://, etc), the result will be an external link equivalent to [<target> <text>]
  • otherwise, the target will be interpreted as the name of a wiki page, and the link will be the equivalent of an internal link like [[<target>|<text>]]

You do not need to edit any PHP files to change the text or target of existing links, you need only find and edit the appropriate MediaWiki:<whatever> pages. (Note: This way you can only edit preconfigured variables. You are not totally enabled to edit the navigation-bar)

In version 1.5[edit]

Follow instructions as per 1.4, except that instead of working with the files LocalSettings.php and DefaultSettings.php, the list is held in the [[MediaWiki:Sidebar]] page. You have to be logged into the Wiki with an adminstrator account to change these pages.

The default should be:

* navigation
** mainpage|mainpage
** portal-url|portal
** currentevents-url|currentevents
** recentchanges-url|recentchanges
** randompage-url|randompage
** helppage|help
** sitesupport-url|sitesupport
In version 1.4[edit]
How the navigation bar is rendered[edit]


The rendering of one of the stock items, the Community portal of the english wiki, in the 4array:

  1. (In blue) The key for the visible text is fetched from the MediaWiki namespace
  2. (In blue) The text under that key is placed in the navigation bar.
  3. (In red) The target page or URL for the link is also fetched from the Mediawiki namespace.
  4. (In red) The text from the "href" key is the link for the entry in the navigation bar.
How to customize your own navigation bar[edit]

The list of pages is defined in an array called $wgNavigationLinks; copy the entire array from includes/DefaultSettings.php to /LocalSettings.php if you wish to edit it (never edit DefaultSettings.php itself). The default array looks like this:

$wgNavigationLinks = array (
 array( 'text'=>'mainpage', 'href'=>'mainpage' ),
 array( 'text'=>'portal', 'href'=>'portal-url' ),
 array( 'text'=>'currentevents', 'href'=>'currentevents-url' ),
 array( 'text'=>'recentchanges', 'href'=>'recentchanges-url' ),
 array( 'text'=>'randompage', 'href'=>'randompage-url' ),
 array( 'text'=>'help',  'href'=>'helppage' ),

Each line of this array represents a link in the navigation box; remember that these are pointers into the database, not the actual text used.

  • To edit a link: you do not need to copy and edit the $wgNavigationLinks array; simply find the appropriate pages, such as MediaWiki:portal and MediaWiki:portal-url, and edit them while logged in with "sysop" privileges. The page Special:Allmessages can be useful for finding these and other editable interface elements.
  • To remove a link: copy the array as described above, and simply delete the appropriate line.
  • To add a new link:
    1. add a line of the form array( 'text'=>'something', 'href'=>'something-url' ),; "something" (Blue in the illustration above) and "something-url" (Red in the illustration above) can be whatever you like, and should be something you will remember and recognise later.
    2. edit (create) the pages MediaWiki:something (Blue above) and MediaWiki:something-url (Red above) in your wiki, substituting the names you chose at step 1 (the "MediaWiki:" part refers to the MediaWiki namespace; whatever names you chose at step 1, the pages to edit will be of the form "[[MediaWiki:<your name here>]]"). The first should contain whatever you want the link's text to be (e.g. "Donate") (Blue above), and the second either the name of a wiki page (e.g. "Project:Get in touch") or the full URL of an external document (e.g. ""). Make sure that if you are linking to a wiki page that you put the name of the page, not a link to that page (no double brackets) or you will end up with a link to an error message (error: link target missing) when the Quickbar is rendered, rather than a link to the intended page.

Edited robbr 8/11/05 - colour references were incorrect

Remember: if your changes don't show up, remember to clear/by-pass your browser cache. Also you must not have $wgUseMemCached set to true, having this set will cause these links to not work.

In version 1.3 or earlier[edit]

In versions earlier than 1.4, there is no simple way to add a new link to the navigation bar. However, the existing links in version 1.3 behave in the same way as described - they are composed from two pages in the MediaWiki namespace.

  • To edit a link: find the appropriate "message" (page in your wiki), for instance by looking at your Special:Allmessages page, and make your changes. For instance, the "Community Portal" link has the text of MediaWiki:Portal, and the target found in MediaWiki:Portal-url; similarly, MediaWiki:Sitesupport and MediaWiki:Sitesupport-url, and others. The target can be either internal (just the name of a wiki page) or external (a full URL, beginning http:// etc).
  • To remove (hide) a link: set the text of the link to "-" (a single hyphen, without the quotes); e.g. if MediaWiki:portal contained only "-", no "Community portal" link would appear.

Remember: if your changes don't show up, remember to clear/by-pass your browser cache.

Using a wikipage as a source for a navigation bar[edit]

Sometimes even the navigation-bars should be available for editing by a normal user, who has no access to the PHP-scripts working in the background. A solution for this approach is to include a defined pagename. The advice below uses the namespace "MediaWiki" and the "function msgWiki( $str )", located in "include/SkinTemplate.php". That function renders a pagename within the MediaWiki-namespace to HTML. Within other skins, not using "SkinTemplate.php" this is not working.

MonoBook (MediaWiki 1.44, 1.54)[edit]

You have to modify the file skin/MonoBook.php This advice works only with the Skin MonoBook

  • Fill this article/wikipage with content (MediaWiki-Markup-Style) like:
  * [[an internal link]]
  * [[another internal link]]
  * [ a external http-link]
  • open the file skins/Monobook.php
  • look for:
  <h5><?php $this->msg('navigation') ?></h5>
    <div class="pBody">
        <?php foreach($this->data['navigation_urls'] as $navlink) { ?>
        <li id="<?php echo htmlspecialchars($navlink['id'])
        ?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php 
        echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>
  • replace the lines:
        <?php foreach($this->data['navigation_urls'] as $navlink) { ?>
        <li id="<?php echo htmlspecialchars($navlink['id'])
        ?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php 
        echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>


      <?php $this->msgWiki( 'MenuNavigation' ) ?>
  • The result should look like this:
  <h5><?php $this->msg('navigation') ?></h5>
    <div class="pBody">
      <?php $this->msgWiki( 'MenuNavigation' ) ?>
  • You can add further navigations-blocks the same way.


HeinzJo 20:39, 12 Jun 2005 (UTC)

How do I change the page footer?[edit]

This is a dynamic element which is implemented in PHP code. If you are using the default MonoBook skin, the "About" and "Disclaimer" links are being generated by the OutputPage() function in includes/SkinTemplate.php.

What about the other elements that are not inside skins/MonoBook.php ?

Tried this with vector. It didn't work as expected.

How do I create a small wiki farm?[edit]

After copying the mediawiki source tree in /opt/mediawiki/ you need to run something like:

 mkdir .../wiki  
 cd .../wiki
 mkdir images
 ln -s /opt/mediawiki/{languages,includes,skins,redirect.php,index.php,maintenance,StartProfiler.php} .
 cp -a /opt/mediawiki/config/ /opt/mediawiki/ .
 chown www-data: config/ images/
 # configure your new wiki and fix the permissions
 rm -rf config

Then add /opt/mediawiki to the commands which set the include_path in config/index.php and add something like this to the main index.php, before require_once():

 ini_set( "include_path", "/opt/mediawiki:." ); # line added
 require_once( './includes/Defines.php' ); # existing line
  • Make sure that your webserver can read from /opt/mediawiki

Obviously each wiki will need its own database or at least a different table prefix.

You may also want to visit Is it possible to install more than one wiki (MediaWiki) on a server? How? for further information about standardising the log in for users across multiple wikis.

You can also look at the (rather complex) setup wikimedia is using

have a look at Help:Wiki family

How do I add w:Metatags[edit]

On the page includes\OutputPage.php is the function addMeta () which can be used to add metatags.

The existing command $wgOut->addMeta ( 'KEYWORDS' , $a.) ; can be added by further keywords just by adding a dot and a comma separated list. The change would look something like

$wgOut->addMeta ( 'KEYWORDS' , $a.', your Keywords, Comma separated') ;

To add further Metatags just add further lines as last lines of the function addMetaTags() like:

$wgOut->addMeta ( 'LANGUAGE' , 'de') ;

Alternatively you can add this to Localsettings.php...

$wgExtensionFunctions[] = 'efSetKeywords';

function efSetKeywords(){
   global $wgOut;
   $wgOut->addKeyword( 'kw1' );
   $wgOut->addKeyword( 'kw2' );
   // ...                                                                                                                                         

This solution can be used to add the same keywords to each page.

How do I add search-engines to the Search-Results for further investigations[edit]

  • Fill that page with content e.g.:
*[$1&hl=de alle '''Google Newsgroups''' nach "$1" durchsuchen]

Important is the variable $1. It is the content of searched words.

  • Open the PHP-file "SpecialSearch.php" within the subdirectory "includes" of the MediaWiki-installationsdirectory.
  • Find the function "function goResult( $term )"
  • Insert at the end before the last line:
    $wgOut->addWikiText( '<p>' . wfMsg('SearchInSearchEngines', $term ) . "</p>\n" );
  • Do the same with function: "function showResults( $term )"
  • Enhancements: Handling empty spaces.

How do I reset the popular page counters[edit]

In <= 1.4:
 UPDATE cur SET cur_counter=0;
In >= 1.5:
 UPDATE page SET page_counter=0;

How do I create a custom namespace?[edit]

See mw:Manual:Using custom namespaces

How do I see a list of users watching a page?[edit]

You can't, mainly because watchlists are considered to be more or less "private" information. Obviously, the information's in the database if you wanted to hack up an extension to do it, but there's no in-built facility for it.

Remark: EnotifWiki indicates the number of watching users in Recent Changes views.

How do I modify the search-engine to search also all 'sister' projects?[edit]


How do I permanently remove old revisions[edit]

A description of how to permanently remove the histories of all current pages is only available for the older versions of mediawiki. How can this be done for the new Version? PHP Script? SQL?

This is the version 1.5.5 workaround that I have come up with on how to permanently remove the histories of current pages from your database.

  • The first step is to go to the page that you would like to delete the revision history of.
  • The Second step is to actually delete that page.
  • The third step is to select restore deleted page from the screen that pops up after deleting the page.
  • Restore only the latest revision of your page.
  • Then log on to phpmyadmin or your favorite db tool and go to your database.
  • Select the archive table from your database and select to empty or truancate it.

This should leave your database nice and clean of all of the former revision entries for that page. (However you might have to control-refresh or clear your history to view the changes when you browse your site.) Soylent red2722 16:12, 10 January 2006 (UTC)

The following code should do it - but dont try it on a live wiki without testing it out first.
Basically the first command deletes any entries in the text table that are NOT the latest revision of the page, and the second command removes any entries in the revision table that are not for the current revision of the page. You may well want to add a restriction to each query to limit the namespaces it runs on (I've included one which limits it to namespace 100).
DELETE FROM text USING text,page, revision WHERE text.old_id=revision.rev_text_id and revision.rev_id!=page.page_latest and revision.rev_page=page.page_id and page.page_namespace=100;
DELETE FROM revision USING page,revision WHERE revision.rev_id!=page.page_latest and revision.rev_page=page.page_id and page.page_namespace=100; 
--Steve A 16:00, 13 April 2006 (UTC)

What about deleteOldRevisions.php in the maintenance folder?

How do I display only so much of an article[edit]

Is there any way to create a template that only displays so many lines of an article?

How can you add a UTF-8 charset box on an Edit Page[edit]

Using JavaScript to insert special characters which is done via the extension CharInsert. Then you have to edit the MediaWiki:Edittools page of your site and customize it by copying and pasting from the sources of other Wikipedia sites. You need to be a Sysop to edit and save this protected page. Download the CharInsert extension from mediawiki and load it into you LocalSettings.php .

How can let the Template:Infobox Software table on right of page[edit]

I have ask many times, but nobody told me how to do. Now I install a new 1.6.3 mediawiki, but the infobox is on left of page. Who can tell me how can let the infobox on right of page? like InfoboxSoftware. Thanks.

Maybe this will set you on the right track:
box on right
<div style="float:right; width:30%; background:red">Box on right</div>
Jonathan1 23:06, 22 January 2007 (UTC)

How can I use the {{#if:}} function ?[edit]

And how can I change the website skin into "vector" ? Note : I'm newbie to MediaWiki software.. Kenrick95 15:25, 5 March 2010 (UTC)

for using {{#if:}} make sure, is installed. the usage is explained here:
your default skin is defined in Localsettings.php. Take a look at Especially look for $wgDefaultSkin

How do you set up a link to a Word document on another server and hide the path etc[edit]

I'm trying to set up a link to an external document (on a different server) and am using the string:

[file:///Q:/Dir1/Dir2/Dir3/etc/<filename>.doc]. This works, but I would like to improve the visual aspect of the viewing page WITHOUT having to upload the file to the wiki (and then using [[Media:<filename>.doc|<Filename>]]) because this has version control implications - I want to link direct to the source file.

Also, when the link fires up, it asks if I want to Open or Save the document and I would like this disabled so that the file instantly opens.

Any help would be appreciated. bja 07:57, 17 March 2010 (UTC)

Maybe this extention?

User administration[edit]

Basic User Account Management?[edit]

As a sysop, how do I see basic information about users like username, realname, email? How do I find the ip of a user for previous edits? What is the best way to roll back a users edits globally?

The following should help (using mysql):
show columns from prefix_user;
select user_name, user_real_name, user_email from prefix_user;
Best wishes Jonathan1 22:58, 22 January 2007 (UTC)

How can I see new user-registrations in RecentChanges?[edit]

What do I have to do, to see new user-registrations in RecentChanges ?

You can use the "Newuserlog"-Extension... you can get it from the CVS-folder. Copy this file into your "extensions"-folder, and integrate the file into "LocalSettings.php"... should work then...

How do I change a user's password?[edit]

Assuming that $wgPasswordSalt is set to true (the default), you can use the following SQL query:

UPDATE user SET user_password = MD5(CONCAT(user_id, '-', 
  MD5('somepass'))) WHERE user_name = 'someuser';

Where obviously "somepass" is changed to the password you want to set and "someuser" is changed to the user name as it is listed in the table "user".

If $wgPasswordSalt is set to false, the SQL becomes:

UPDATE user SET user_password = MD5('somepass') WHERE user_name = 'someuser';

Note: the user_id in the CONCAT string is a column name and is not meant to be replaced with 'someuser'

Note: For error of table 'dbname.user' does not exist, please check the LocalSettings.php for $wgDBPrefix, the user table might be named to ($wgDBPrefix)user.

There is a script maintenance/changePassword.php to do the job

 php maintenance/changePassword.php --user=username --password=newpassword

User forgot his/her password, has no e-mail address[edit]

Let the user step through a "mail me a temporary password" cycle with a working e-mail address of his/her choice, which you temporarily enter into his/her user account record.

You need to have

(a) access to the Wiki database (table user) and
(b) a working e-mail system.

Check requirement (b) by mailing yourself a temporary password via the login screen button. Make sure that you have set up your own e-mail address correctly.

  1. As WikiSysop you enter temporarily user's e-mail address into user account in db table user.
  2. Tell the user to click "Mail me a temporary password" on the wiki login screen
  3. S/he will receive a temporary password soon
  4. S/he can now login with the password and
  5. S/he now must set up a new password for her/his account

The trick also overcomes any problem with salted or unsalted passwords.

How do I allow only logged-in users to edit?[edit]

See mw:Manual:User rights for questions relating to user rights.

First you need to determine MediaWiki version. Go to Special:Version at your wiki.

MediaWiki version 1.5.1 or later[edit]

To stop people other than this Sysop (Admin) from creating accounts, add this line in LocalSettings.php:

   // Only SysOp (Admin) can create accounts -
   $wgGroupPermissions['*']['createaccount'] = false;   
  • Logged-in users will still be able to create accounts if that's the only line you change.

To stop people from anonymously editing pages without being logged in, add this line in LocalSettings.php:

   // No anonymous editing allowed -
   $wgGroupPermissions['*']['edit'] = false;

MediaWiki version earlier than 1.5.1[edit]

Add this in LocalSettings.php:

$wgWhitelistEdit = true;


To test whether anonymous editing disable worked, make sure you are really logged out. Possibly you will be kept logged in using some cookie or whatever, in such case press "Log Out" in top right corner.

How do I require an email address be specified at registration?[edit]

See mw:Manual:$wgEmailConfirmToEdit.

How do I allow only authorized users to edit pages?[edit]

Add the following to LocalSettings.php:

// Prevent anonymous users from editing
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['*']['createtalk'] = false;

// Prevent registered, non-confirmed users from editing
$wgGroupPermissions['user' ]['move'] = false;
$wgGroupPermissions['user' ]['edit'] = false;
$wgGroupPermissions['user' ]['createpage'] = false;
$wgGroupPermissions['user' ]['createtalk'] = false;
$wgGroupPermissions['user' ]['upload'] = false;
$wgGroupPermissions['user' ]['reupload'] = false;
$wgGroupPermissions['user' ]['reupload-shared'] = false;
$wgGroupPermissions['user' ]['minoredit'] = false;
$wgGroupPermissions['user' ]['delete'] = false;

// Allow confirmed users to edit
$wgGroupPermissions['confirmed' ]['move'] = true; // Only add this line if you want all users to be able to move
$wgGroupPermissions['confirmed' ]['edit'] = true;
$wgGroupPermissions['confirmed' ]['createpage'] = true;
$wgGroupPermissions['confirmed' ]['createtalk'] = true;
$wgGroupPermissions['confirmed' ]['upload'] = true;
$wgGroupPermissions['confirmed' ]['reupload'] = true;
$wgGroupPermissions['confirmed' ]['reupload-shared'] = true;
$wgGroupPermissions['confirmed' ]['minoredit'] = true;
$wgGroupPermissions['confirmed' ]['delete'] = true;

You can authorize a user to edit pages by putting them in the 'confirmed' group using the Special:Userrights special page. See also this article for more information on managing user rights.

How do I allow only authorized users to read pages?[edit]

In addition to the section above, add this to LocalSettings.php:

$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['user' ]['read'] = false;
$wgGroupPermissions['confirmed']['read'] = true;

// Put all pages everybody is allowed to view here. At least Special:Userlogin has to be in here
$wgWhitelistRead = array("Main Page", "Special:Userlogin");

How do I reassign edits from one user to another?[edit]


cd <path to mediawiki>
rm attribute.sql
php maintenance/attribute.php OldUserNameOrIP NewUserName
mysql < attribute.sql

Always start with a fresh sql file, since attribute.php appends to it. The nice thing is you can run attribute.php a bunch of times, then commit them with one run of mysql.

1.5.7 upwards[edit]

Run the reassignEdits maintenance script from the command line to reassign edits from one user to another.

Usage: php reassignEdits.php <from> <to> [--force]

    <from> : Name of the user to assign edits from
      <to> : Name of the user to assign edits to
   --force : Reassign even if the target user doesn't exist

1.11.0 and later[edit]

Use the ChangeAuthor extension

How do I make myself the Bureaucrat of my wiki?[edit]

See mw:Manual:FAQ#Initial user was not created by installer.

How do I make a user a Sysop?[edit]

If you have the appropriate rights (see mw:Manual:User rights management), go to Special:Userrights and enter the username. Click on "sysop" from the "Available groups" list.

How do I remove Sysop-Rights from a user?[edit]

See mw:Manual:User rights management.

How do I manage user rights and groups?[edit]

see mw:Manual:User rights management and mw:Manual:User rights.

How do I allow any user to edit but the edited pages only updated on wiki after being approved by moderators?[edit]

Add the appropriate functionality to the code. ;p There is no way of doing this with the current software, although if written well it could prove a useful alternative for page protection.

Koset writes:
I have a simple solution. Replace the following line in includes/UserMailer.php

$dest = $to->toString();
$dest = "";

Note, you'll have to do this in TWO places. This way, you receive all mail intended for users. You can approve them by simply forwarding them. You may want to change the "from" address to look wiki-official. --Koset

How do I edit the Log in page to add a question so that only people with the correct answer are allowed to create a new account?[edit]

Use the QuestyCaptcha method in the Wiki extension ConfirmEdit

How do I delete a user from my list of users?[edit]

MediaWiki does not natively support the deletion of user accounts. To prevent an account from being used, either scramble the password or set up an indefinite block on the account. See the User Merge and Delete extension.

Do not remove users from the user table in the mySQL database; this causes problems with other parts of the wiki due to the relational structure of the database.

How do I scramble the password or set up an indefinite block?[edit]

A wiki system administrator can block a username on the Special:Blockip page (a restricted special page - look under Special pages in the toolbox). One of the options for the block length is infinite.

Alternately, an administrator with direct access to the wiki database can change a user's password. Scrambling a password is simply changing the password to some random text. The script from the "How to change a user's password" FAQ (above) can be used.

But can I rename the user, then?[edit]

Deleting the user is not strictly necessary, but it would helpful to be able to rename it to something neutral. Is it possible to change the username to something else?

In MediaWiki 1.5 and upwards, bureaucrats can rename users directly in the wiki with the Renameuser extension installed. In previous versions, it required direct manipulation of the database:

update low_priority user set user_name='NewUsername' where user_name='OldUsername';
update low_priority user_newtalk set user_ip='NewUsername' where user_ip='OldUsername';
update low_priority cur set cur_user_text='NewUsername' where cur_user_text='OldUsername';
update low_priority old set old_user_text='NewUsername' where old_user_text='OldUsername';
update low_priority archive set ar_user_text='NewUsername' where ar_user_text='OldUsername';
update low_priority ipblocks set ipb_address='NewUsername' where ipb_address='OldUsername';
update low_priority image set img_user_text='NewUsername' where img_user_text='OldUsername';
update low_priority oldimage set oi_user_text='NewUsername' where oi_user_text='OldUsername';
update low_priority recentchanges set rc_user_text='NewUsername' where rc_user_text='OldUsername';

How do I block a range of IP?[edit]

How do I block a range of IP, e.g. 84.172.2xxx, so that every user, starting with this IP will be blocked?

Have a look at: Range blocks. Note that even registered users using these IPs will be blocked, too.

How do I change the name of the default administrator?[edit]

Instead of changing the name of the administrator, create a new user with the desired name, and assign sysop privileges to that user with Special:Userrights (1.5 and later), or Special:Makesysop (pre-1.5).

If this is to be your primary account on the wiki, you may want to consider assigning the bureaucrat privilege as well.

How do I assign a username to an IP address?[edit]

(Question asked by Blueeyor on 20:06, 25 Apr 2005 (UTC))

You can't have a specific IP become a specific user. You can check the "remember me" box.

If you want all the edits of one IP to be attributed to an user, see How do I reassign edits from one user to another? above.

How do I change an edit history from an IP address to a userID?[edit]

(Question asked by Blueeyor on 20:06, 25 Apr 2005 (UTC))

See How do I reassign edits from one user to another? above.

How do I make a page only viewable by a WikiSysop or Bureaucrat or a particular user?[edit]

(Question asked by Wiseleyb 26 Apr 2005)

There are three hacks (patches) for this. See Page access restriction with MediaWiki, Hidden pages and Regular expressions for wgWhitelistRead.

How to add a new user when anonymous wiki access is not allowed?[edit]

Login as a sysop/admin then use to add the new user account.

How do I restrict User:<username> page to be edited by only <username> and Sysop?[edit]

The current version of the Page access restriction with MediaWiki patch allows you to do this.

How do I make it so that only logged-in users can see the toolbox?[edit]

Look at this page: Customization#How do I remove the toolbox for users that are not logged in.3F --RaZorEdge qc 03:38, 4 February 2006 (UTC)

How do I add multiple user accounts?[edit]

Login as a sysop then use the special page: Special:Userlogin to add the new user's account.

I have had good luck in 1.4 and 1.5 with importing tab-delimited data into the mw_user table. This was for an "authorized-editors only" site, with public read, but only member write. I disabled public editing and account creation, imported the user data, with an illegal password field (any single character will do), then required users to use the "mail me a new password" button in order to log in and change their password. --Bytesmiths 21:24, 19 December 2005 (UTC)

One option is ImportUsers extension. --Rouslan Zenetl 00:42, 6 January 2007 (UTC)

How do I edit error messages?[edit]

Special:Allmessages contains a complete list of messages (error or otherwise), that can be edited. Alternatively, you could also view and edit your languages/Language.php file, which also contains some messages.

How can I edit wiki that everytime a new article is created, users get email notification?[edit]

Looks like there's an email notification extension that will do this.

How do I, as an owner of two wikis, get the ability to use CheckUser on those wikis?[edit]

A little more info, our wikis are not a part of wikimedia or its projects, we just use the mediawiki software. How do we get access to checkuser to help combat spam and vandals on those wikis? --PatriarchAnthony 08:20, 13 January 2006 (UTC)

  1. Install the CheckUser extension from CVS
  2. Set the value of $wgCheckUserLog in LocalSettings.php to point to a writable log file
  3. Grant the checkuser permission using Special:Userrights
Rob Church Talk 23:14, 19 February 2006 (UTC)
I got CheckUser.php - But how to do the rest? Where to read? --Reinard 13:46, 22 March 2006 (UTC)
Just to expand on the installion of CheckUser. I had a bit of trouble since it was the first extension I'd ever tried to install,
  1. Copy the php file from CVS to your extensions directory, e.g. extensions/CheckUser.php
  2. Add the following to LocalSettings.php: require_once( "extensions/CheckUser.php" );
  3. Creating a log file isn't strictly necessary, but you should probably make one and add this line to LocalSettings.php: $wgCheckUserLog = "logs/CheckUser.log";
  4. Go to your wiki page Special:Userrights as an Admin and give yourself (at least) permission to use CheckUser. Don't forget this part or you'll get an error message that the CheckUser page doesn't exist, even though Checkuser is actually working.
Littlepinkpig 23:40, 12 April 2006 (UTC)

How do I force anonymous users to login, but not create accounts, nor see any other pages?[edit]

see Disable anonymous reading,
do steps 1, 2, 3

Q: I want to create all accounts myself -- as a sysop. I set $wgGroupPermissions['*']['read']=false; as well as 'edit' and 'createaccount'. This is "very secure", but prevents the anonymous users from even accessing the "Special:Userlogin" page — the only way for them to stop being anonymous. How do I solve this problem?

A: Ok, one needs to list the "Special:Userlogin" explicitly in the $wgWhitelistRead array in DefaultSettings.php (this file provides examples, it is located in the -includes- directoy). The trick is, the page's title is different depending on the language used, and -- in case of non-ASCII language -- must be entered in Unicode. In my case -- ??????????:Userlogin.

  • I don't think you should edit DefaultSettings - copy it to LocalSettings and put it there. Otherwise it will be lost when you upgrade MediaWiki.

Additional note: Sometimes in Windows system that even you entered Unicode, it still won't work, the solution is following:

For more esoteric languages, for which your editor and PHP parser might be in disagreement over file encoding such as under Windows, you could use the PHP urldecode() to input the page names. For example in Hebrew you could use:
#                              "Special":Userlogin (in Hebrews)                    
$wgWhitelistRead = array( urldecode("%D7%9E%D7%99%D7%95%D7%97%D7%93:Userlogin"),
#                                "MainPage" in Hebrew
                          urldecode("%D7%A2%D7%9E%D7%95%D7%93_%D7%A8%D7%90%D7%A9%D7%99") ) ;

How can I exclude a few Pages from GroupPermissions control?[edit]

on my local mediawiki 1.5.6 installation I've set GroupPermissions so that only logged in Users can edit (works well). Now I want to set a few (really just < 10) pages to be editable by anonymous. I tried hacks in index.php and Title.php, without success. It' exactly the feature wgWhitelistEdit had done till version 1.4 - but this doesn't work in 1.5 - please help. --GerhardSchwarz 13:12, 29 March 2006 (UTC)

After a few days work, here is my own solution: ExplicitEdit (de) --GerhardSchwarz 13:11, 6 April 2006 (UTC)

How can i use excel like functions (sum,avg)?[edit]

I've seen it in other wiki implementations and i find it really useful, is it possible to use it in media-wiki? One column would contain e.g. =sum(B2,B4)

Can I restrict access to a category by usergroup?[edit]

Can I search by category names?[edit]

Kita wrote:

There are pages that have been assigned to more than one categories. Is there a way to do searches based on category names? Let's say, a page "Drill" is classified as "Hardware", "Electronics", and "Tool" categories. And I'm looking for a method to search pages that have all those categories assigned, regardless of the page content.

This "category based search" would work as a tag-combination search.

How does one add a logo across the top of the page[edit]

How does one add a logo to the top of the page, for example [3]

Change Background[edit]

How can the sunset type background near the logo in monobook be changed?

The "sunset type" background is in fact a grayscale drawing of an "open book", the "suns rays" are the pages emanating from the spine. You can change it by altering "Mediawiki:Monobook.css" like this example:

/* CSS placed here will affect users of the Monobook skin */
body {
	background: #b0d0ff url(/_CONTENT/headbg.jpg) 0 0 repeat-x;

This will not work if you set $wgUseDatabaseMessages = false; in your localsettings.php. In that case you can either edit the main.css in the monobook skin or upload an alternative headbg.jpg in the monobook skin folder. This alternative method has drawbacks when you come to upgrade to later versions of mediawiki where your altered monobook skin may be replaced with the original.

There are some links at the top of monobook, can they be removed[edit]

How do you remove the 'ipaddress' and 'talk for this ip' links at the top of the monobook link?

How do you set up a link to a Word document on another server and hide the path etc[edit]

I'm trying to set up a link to an external document (on a different server) and am using the string:

[file:///Q:/Dir1/Dir2/Dir3/etc/<filename>.doc]. This works, but I would like to improve the visual aspect of the viewing page WITHOUT having to upload the file to the wiki (and then using [[Media:<filename>.doc|<Filename>]]) because this has version control implications - I want to link direct to the source file.

Also, when the link fires up, it asks if I want to Open or Save the document and I would like this disabled so that the file instantly opens.

Any help would be appreciated.


Use {{unc| \\server\folder\file |OptionalDisplayName}}

UNC requires two additional plugins as well as configuration. See UNC links for additional details.

Is there a way to set permissions so Talk pages can be edited by registered users, but the actual pages cannot?[edit]