Manual:FAQ/zh



MediaWiki, Wikimedia(维基媒体基金会), Wikipedia(维基百科)和wiki间的区别是什么?
这个问题经常被问到,请参阅Wikipedia、Wikimedia、MediaWiki 和 wiki 的区别页面获得更详细的答案.

我能将MediaWiki用于某个用途么?
MediaWiki是自由软件,这意味着你可以以任意方式使用它而不需要法律上的许可. Furthermore, its licensing conditions apply solely to the software itself. This means that although many wikis license their content under a permissive license, you are not obliged to license the content submitted to your wiki in any particular way. 当然,作为支持维基百科运行的软件而发展起来的项目,我们鼓励你使用一个自由许可证授权你的wiki上的内容,但是这不是必须的.

如果你希望修改MediaWiki软件,没有问题!但是这里有一些限制,查看GNU 通用公共许可证第二版的全文了解详细信息. 因为MediaWiki是免费使用的，在适用的法律允许的范围内没有担保责任.

到哪里里下载MediaWiki?
点击这里前往下载页.你会下载到一个.tar.gz归档文件. 你也可以 通过Git从我们的版本库中下载.

如何安装MediaWiki?
安装MediaWiki的预计时间为10到30分钟,包括上传与复制文件,和运行设置脚本. 请参阅安装指南,你也可以在那里找到系统需求.

能通过软件包管理器安装MediaWiki吗?
大部分Linux发行版都会以分发包的格式提供MediaWiki软件. MediaWiki开发团队认为您应该向您的Linux发行版提供者咨询安装与配置的事宜. 负责维护这些分发包的独立社群和公司应该向您提供安装指南.

但是请注意因为软件源中的MediaWiki可能不是最新的，所以请密切关注你所使用的扩展的兼容性.


 * 另请参阅: MediaWiki软件套装（英文）

我能在一个服务器上运行多个MediaWiki网站吗?
只要满足下列条件，您就可以在一台服务器上安装多个wiki：

或者
 * 您的每一个wiki使用各自不同的数据库
 * 您的每一个wiki的数据库前缀不相同（如果您用的是PostgreSQL，在不同的模式或用户下，也能达到这一效果）

要了解这些选项的相关信息，可分别参见$wgDBname与$wgDBprefix.

要了解设置wiki家族的相关信息，可参见Manual:Wiki家族.

要了解将多个wiki设置为使用相同服务器、数据库与资源的其他方法，参见来自Steve Rumberg（存档）用户的更深层的解释与进一步的意见.

MediaWiki能在安全模式下工作吗?
可以，但其功能会受到一定限制. 参见安全模式.

MediaWiki需要Shell访问吗?
终端访问（SSH访问）在安装MediaWiki的过程中并不是必须的，但我们强烈推荐你这么做. 如果不能进行终端访问，您可能难以对您的wiki进行备份，或难以将它升级到更新的版本. 如果完全脱离终端访问，您将不能完成一些维护任务. Many major extensions work best with shell access.

如何安装扩展?
参见Manual:Extensions获取安装插件与编写插件的相关信息. 见Category:插件以寻找已有的插件.

如何添加额外的名字空间?
参阅Creating a custom namespace.

如何启用文件上传?
文件上传是MediaWiki常用的功能之一，但在目前所有的发行版中都被默认关闭了. 要启用它们，首先要让网站服务器上的上传文件夹（默认为 ）可被写入（chmod 777或允许Apache用户写入内容，等等），然后在LocalSettings.php中将$wgEnableUploads设为 值（例如“$wgEnableUploads = true;”）. 如果你在上传时遇到了一个"failed to mkdir" （无法创建文件夹）错误，你可能需要调整你的服务器上的文件权限.


 * 也请参阅：Manual:Configuring file uploads

如何在MediaWiki中显示数学公式?
MediaWiki允许用户插入数学公式. 参见Manual:Math获取安装指南.

如何设置我的Wiki的时区?

 * 请参阅： Manual:Timezone

如何强制刷新一个缓存页面?
有时您需要刷新被缓存的页面，比如当页面的导航栏发生了变化后. 在页面的动态URL后加上 即可.

例如：http://www.mediawiki.org/w/index.php?title=Main_Page&action=purge

或在页面的短型URL后加上 ：

例如：http://www.mediawiki.org/wiki/Main_Page?action=purge


 * 也请参阅：Manual:Purge, Manual:Parameters to index.php.

如何完全停用缓存?
将下列语句加入LocalSettings.php即可： $wgEnableParserCache = false; $wgCachePages = false;

如何允许上传其他格式的文件?
MediaWiki 使用$wgFileExtensions来限定允许上传的文件格式. 例如,要允许用户上传PDF格式文件,请将下面一行增加到你的LocalSettings.php中:

例如,要允许用户上传PDF格式文件,请将下面一行增加到你的LocalSettings.php中:

可以像下面这样一次添加多个文件类型:


 * 也请参阅：Special:MyLanguage/Manual:Configuring file uploads

"文件已损坏或者扩展名不正确"
有些用户报告说，在向已允许扩展名列表中增加文件格式后，软件会发生错误. 出错后的文字类似于下方：


 * 文件已损坏或存在无效扩展名. 请重新检查并上传文件. 

可能的解决方案：


 * 设定$wgMimeDetectorCommand的值，例如：在Unix或Linux，您可以将它设为 :
 * 编译／安装PHP插件fileinfo
 * Fedora - yum install php-pecl-Fileinfo
 * Fedora - yum install php-pecl-Fileinfo


 * 也请参阅：Manual:Mime type detection.code>

安装程序没创建一个管理员用户?
有时可能因为安装程序没有成功运行或是用户表丢失的缘故导致没有管理员账户, 这里有几个修复的方法:

maintenance/createAndPromote.php

 * 对于1.16以前版本的MediaWiki,确保 配置正确(参阅 )
 * 在shell中运行  . 要让新创建的用户既成为管理员又成为行政员,加入  参数.

这会创建一个新用户并授予管理员权限, 运行  获得帮助.

在数据库中修改

 * 用一般方法注册一个账户 (Special:UserLogin).
 * 在 Special:Preferences 中查看用户ID.
 * 在数据库中执行下列SQL语句:
 * 用你刚刚查阅的用户ID替换.
 * 注意: 如果LocalSettings.php中定义了  ,记得加在表名前. 例如   = "XYZ"时的表名是.
 * 注意: 如果LocalSettings.php中定义了  ,记得加在表名前. 例如   = "XYZ"时的表名是.

临时允许任何人修改用户权限,然后给初始化时创建的用户分配权限
为了能修改用户权限,这个操作的关键是允许所有用户修改权限.
 * 用一般方法注册一个账户 (Special:UserLogin), 然后登录.
 * 在LocalSettings.php中加入下面一行
 * 在 special:userrights中将新创建的用户添加到管理员与行政员组.
 * Remove the  line from your LocalSettings.php . This step is very important, as until you remove it anyone can alter permissions, which is bad.
 * Remove the  line from your LocalSettings.php . This step is very important, as until you remove it anyone can alter permissions, which is bad.

如何重置密码?

 * 参阅 Manual:Resetting passwords

如何创建或修改跨wiki链接?

 * 参阅 Manual:Interwiki

如何让显示的URL更短?
(例如用 /wiki/Article_Name as opposed to /w/index.php?title=Article_Name)
 * 参阅 Manual:Short URL

我能像目录一样组织页面吗,像/wiki/subdir/PageName这样?

 * 参阅 Manual:$wgNamespacesWithSubpages, Help:Subpages

下载和使用MediaWiki是免费的吗?
是的，在自由软件意义下的自由. 参见Project:Copyrights了解本站已有内容在许可协议方面的问题.

如何管理用户权限?
 参见Manual:用户权限与Manual:用户权限管理获取常见的信息. 参见Manual:访问控制获取限制访问的方法与措施.

如何阻止匿名用户编辑页面?
建议修改. 添加下面一行到 :

通过Extension:AbuseFilter,管理员可以临时阻止匿名编辑.


 * 也请参阅：阻止访问, Manual:User rights.

如何阻止匿名用户创建页面?
也请参阅 Manual:$wgWhitelistRead. 参阅Manual:Preventing access for more information.
 * 添加下面一行到 的最下面:

如何阻止创建账户?
参阅Manual:Preventing access for more information.
 * 添加下面一行到 的最下面:

如何在注册时要求提供电子邮件地址?

 * 参阅Manual:$wgEmailConfirmToEdit

如何让MediaWiki只读?

 * 参阅Manual:$wgReadOnly

如何修改默认的用户设置?
MediaWiki 将默认的用户选项保存在语言文件中,例如. 但是和DefaultSettings.php一样,别修改它,做参考就好.

查找你要修改的选项 在Language.php,例如:

要改成50的话,在LocalSettings.php里添加: 注意是设置$wgDefaultUserOptions,而不是$wgDefaultUserOptionsEn. Any settings in $wgDefaultUserOptions will override those set in the language file.

要改变默认搜索的名字空间,在LocalSettings.php里设置$wgNamespacesToBeSearchedDefault. 例如要默认搜索主名字空间和分类名字空间:

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

某些情况下,你在改变默认设置后希望改变现有用户的设置.

要这样做的话,在maintaince目录运行userOptions.php. 第一次运行建议加入 "--dry" 参数（这个参数用来模拟运行，不会修改数据库. ）.

php userOptions.php --dry --nowarn searchlimit --old 20 --new 50

另外，在进行实际操作前建议备份数据库.


 * ''也请参阅：Manual:$wgDefaultUserOptions

如何优化MediaWiki的运行速度?

 * 请参阅： Manual:Performance tuning

如何启用搜索建议?

 * 请参阅： Manual:Enabling autocomplete in search box

升级

 * 请参阅： Manual:Upgrading

能把我的wiki移动到另一台电脑上吗?
Yes. 应该可以, 实质上就是备份你的安装然后"还原"到一台新电脑上. 然后对配置进行一些适当的调整以适合新服务器的需要.

那么,如何做?
参阅 Manual:Moving a wiki.

如何修改左上角的标志?
左上角的标志是由LocalSettings.php中的$wgLogo选项决定.

有两个方法可以修改:


 * 1) 通过标准上传界面向你的wiki上传一张图片, 这样以后修改起来也容易,所以你可能希望保护它防止被篡改.
 * 向LocalSettings.php添加$wgLogo参数, 例如:
 * 1) 或者向服务器直接上传一张图片.
 * 向LocalSettings.php添加$wgLogo参数, 例如:
 * (这个例子中图片和LocalSettings.php在一个文件夹中.)
 * (这个例子中图片和LocalSettings.php在一个文件夹中.)
 * (这个例子中图片和LocalSettings.php在一个文件夹中.)

要改变某些页面的标志,覆盖#p-logo的background-image属性,或者使用像Extension:LogoFunctions这样的扩展.

如何编辑wiki的CSS?
别直接编辑像main.css一类的CSS文件,因为这样会使你日后的升级变得困难. 要改变全站的样式,编辑MediaWiki:Common.css,要改变特定皮肤的样式(例如Monobook),编辑MediaWiki:Monobook.css.这些页面的内容会覆盖main.css中的值.

The content of MediaWiki:Common.css and MediaWiki:Monobook.css pages always override the default CSS styles specified in main.css.

如何隐藏左侧的导航栏
换句话说,你希望内容占据全部的宽度来隐藏logo和左侧导航?

要隐藏它们,将下面的代码添加到MediaWiki:Common.css中.

要只在用户按下F11时隐藏,将下面的代码添加到 MediaWiki:Common.js:

如何隐藏页面底部的分类列表?
添加这一行到你wiki的MediaWiki:Common.css中

我能自定义左侧顶部的标志吗,如果可以的话,怎样做?
The logo is a portlet block without a pBody section. It is identified by the p-logo id. The background image is specified by the $wgLogo variable, which is defined in DefaultSettings.php. This location is relative to the web server root and not the system root. Redefine this in LocalSettings.php to change the image. If set wrong there will be no image on the page; check your web server error log and adjust accordingly. However the size of the p-logo will need to be big enough for the logo if it is not to be clipped. This is set in the stylesheet (main.css in Monobook), under the p-logo style, the default setting is:

Note, if you are using a different sized logo, and want to change the CSS, please do not modify any of the core MediaWiki stylesheets. Instead add to the on-wiki css page (MediaWiki:Monobook.css for monobook, MediaWiki:Vector.css for vector. MediaWiki:Common.css will also work for all skins)

如何改变点击左上角的标志后跳转到的页面?
默认情况下点击logo会返回到首页,要指定哪一个页面是首页,编辑MediaWiki:Mainpage. 要在点击logo时前往任意的其他页面(不一定是你的wiki),你可以向LocalSettings.php中增加一个hook来覆盖默认设置.

To make the link of the site-logo link externally to any other arbitrary URL, you can add a hook to your LocalSettings.php to override the mainpage href which is used by the logo.

改变标志的大小
Note that a tag is on top of the logo so if you are trying to reduce the size of the logo's portlet you will also need to change the #p-logo a and #p-logo a:hover rules. The default setting for these is:

如何改变地址栏的图标 (favicon)?

 * 把favicon.ico上传到你的服务器的根目录.
 * 或者编辑LocalSettings.php中的$wgFavicon,增加

参阅Manual:$wgFavicon获得更多细节.

提示: favicon 的大小应为16x16 / 32x32 像素.

Rewrite 规则
如果你有用URL重写规则从URL中移除"index.php",你也需要为.ico加个例外.把下面一行加入到.htaccess中: 把下面一行加入到.htaccess中:


 * RewriteRule .*\.ico$ - [L]

这个规则必须在index.php的规则之前.

注意区分大小写
记得favicon.ico的文件名全是小写("favicon.ico",而不是"Favicon.ico"). 大多数的服务器(例如类UNIX系统)可能找不到有大写的文件名.

如何定义导航栏?
使用Monobook皮肤的每一个页面左边是导航条，其内容由您的wiki上的MediaWiki:Sidebar 页面决定. 定制这些内容的相关信息，请参看Manual:Interface/Sidebar.

如何在每一个页面上放置一个消息(站点通告)?
在MediaWiki:Sitenotice放置一些文本.内容会显示在所有的页面上方.

你也可以在MediaWiki:Anonnotice上放置一些文本,当用户未登录时会出现在页面的上方. It is often a good idea to transclude the site notice on the anon notice to make sure that logged-out users still get the information on the site notice,

如何指定首页?
默认的首页名称为"首页".编辑MediaWiki:Mainpage来改变. This can be changed by altering the contents of  MediaWiki:Mainpage to point to a different title.

有时边栏中的"首页"链接可能没有改变,这时需要编辑 MediaWiki:Sidebar.

如何改变首页的标题?
Simply click on the "Move" tab, and move the page to the desired page title.

Usually you also want to change which page is the configured as "main page".

How do I hide the main page title?
MediaWiki does not have a built-in option to hide the main page title (see ), but you can use CSS to hide the title. Alternately, you can use the NoTitle extension.

Add the following to on your wiki:

If this doesn't work, you may be using a skin that doesn't support this, or you moved your main page without updating MediaWiki:Mainpage, or you have a really old MediaWiki version.

If the skin uses a different element for the title than a  element with class , you'll need to find the appropriate CSS selector to apply for that skin.

How can I hide the table of contents?
The table of contents (TOC) is automatically shown once there are four or more headings in the article. There are multiple ways to hide it.


 * For one page
 * Place the magic word  in the page's wikitext.


 * For all pages
 * Install Extension:NoTOC
 * or
 * Add the following rule to MediaWiki:Common.css:


 * Per user
 * Users can add the same CSS rule to their common.css personal stylesheet.


 * There was a user preference to hide the table of contents, it was removed in MediaWiki 1.23 (T54813).

How do I change the interface text?
Interface text is altered using the MediaWiki namespace. For each deviation from the default in the site language there is a page MediaWiki:Englishmessagename, and for each deviation from the default in each other language a page MediaWiki:Englishmessagename/languagecode. (Since release 1.9 there are no pages for messages equal to the default.). On creation of a page the edit box autofills with the default. When creating a page to override the default it is useful to first save the default version, to allow diffs with it. See also Manual:System message.


 * For a list of system messages, see Special:Allmessages
 * To switch off the MediaWiki namespace, see the $wgUseDatabaseMessages configuration setting
 * To remove the Privacy policy or Disclaimers links at the bottom of each page, set the content of pages MediaWiki:Privacy or MediaWiki:Disclaimers respectively to a single hyphen.

How do I change the interface language?
To change the default interface language, alter the value of  in , for example

You may also need to bypass your browser's cache to see the changes.

The new default interface language will be applied to all users who haven't ever customised it.

If you want to provide users the possibility to create and choose pages and interface elements in languages other than the default one of the wiki, you need the Translate extension, which can make your wiki multilingual.

How do I remove the article/edit etc tabs?
For a little more control see: User:Subfader/Hide_page_tabs

Edit MediaWiki:Common.css on your wiki, and add this:

See the page source for the various #ca-* ids used in the content tabs.

Note: this will only work for Monobook and derived skins such as Modern and Vector (the default skin), and doesn't actually stop people from editing. To do that, see Manual:User rights.

How do I add/remove tabs throughout my wiki?
Use Extension:DynamicTabs on older MediaWiki installations or write your own extension (See: Manual:Hooks/SkinTemplateNavigation):

For example, to remove the talk tab and then add a tab that always goes to the main page you would save this code in :

and then add to the bottom of LocalSettings.php

How do I remove a tab on only one page?
For example, to remove the Discussion (talk) page tab from the Main Page, on the MediaWiki:Common.css page add:

To modify MediaWiki:Common.css you must have administrative privileges.


 * See also: Manual:Hide page tabs

How do I remove a tab on all pages
For example, to remove the Discussion (talk) page tab on all wikipages, on the MediaWiki:Common.css page add:

Other tabs to remove are #ca-history, #ca-viewsource, #ca-view (Read tab), #ca-nstab-main (Page tab), #ca-viewsource.

Other drop down menu items you can remove are #ca-watch, #ca-move, #ca-delete.

To modify MediaWiki:Common.css you must have administrative privileges.

How do I hide the section edit links for users who are not logged in?
You can change the value of the configuration option.

Edit and add the line:


 * Also see 

How do I remove the "Talk for this IP" link at the top right when $wgDisableAnonTalk is true?
Set $wgShowIPinHeader to false.

How do I remove the "Create an Account or Login" link at the top right of the screen?
To remove the login / create account links from the personal_urls you can use this code in your to hook in and remove them:

How can I suppress actions and special pages?

 * NOTE: MediaWiki is not designed for this kind of usage! It should be noted that the following 'answer' is a hack that only 'works' with the Apache webserver. Note also that this system is not foolproof, it's just one step further than hiding the links (see above).

Suppressing actions and special pages can be useful when you want to create the illusion of a static website via a particular URL or VirtualHost, but also have an 'internal' view that is a true wiki. i.e. if you have an inward facing 'view' of your wiki that users can edit, and an outward facing 'view' that should appear like a static website (no history, no discussion, etc., etc.).

After hiding all the appropriate links (see above), if you are using the Apache web server, you can disable actions and special pages using the following rewrite rules:


 * 1) Lock down the site (disable MediaWiki commands)

RewriteEngine On


 * 1) RewriteLog /tmp/rewrite.log


 * 1) RewriteLogLevel 9


 * 1) See http://www.mediawiki.org/wiki/Manual:Parameters_to_index.php#Actions

RewriteCond %{QUERY_STRING} (.*action=.*) RewriteRule .* http://www.my.domain.com?

RewriteCond %{REQUEST_URI} !^/index.php/Special:Search RewriteCond %{REQUEST_URI} ^(.*Special:.*) RewriteRule .* http://www.my.domain.com?

RewriteCond %{QUERY_STRING} ^(.*Special:.*) RewriteRule .* http://www.my.domain.com?
 * 1) Catch a trick...

Above, a request for, for example, will be simply rewritten to. Similarly any page in the Special namespace (with the exception of Special:Search) will be rewritten to. Remember, this is only a hack, and isn't intended as a solution for a secure CMS.

Note that you will need to adjust the above rules to match your specific URL naming schema.

Other issues to consider when trying to lock down a site like this is the API and POST requests for the wiki content (rather than GET).

How do I edit error messages?
Special:Allmessages contains a complete list of messages (error or otherwise), that can be edited.

How do I change the footer?

 * See Manual:Footer and Manual:Configuration settings

How can I edit / remove the Powered by MediaWiki image in the footer?
You can hide the Powered by MediaWiki image by adding the following to your wiki's MediaWiki:Common.css:

The Vector skin equivalent is:

In MW 1.17 with Vector Skin:

In MW 1.18 with Vector Skin:

If you want to remove it completely in 1.17 you can use to remove it using this in your :

In 1.16 and below you will have to use a hook to remove it:

If you wish to change the icon images, urls, alt text, or add new icons please see ' documentation.

How do I add a reply link to default signature tildes ( ~ ) template?
You can customize at: MediaWiki:Signature / MediaWiki:Signature-anon

For example, changing the entries to  will put a link to users' talk pages and   would give a more direct link.

Users can change it their preferences.

How can I change what the of each page is? Where do I make changes?
Most of the text that you want to change can be found in the namespace of MediaWiki.

In order to change titles, texts, announcements, etc., go to Special:AllMessages, where you will see the text associated with the pages you wish to change. You need to log in as an administrator 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 - by default. If is producing the wrong text for you, you need to set $wgSitename in your LocalSettings.php.

If $wgSitename is correct in LocalSettings.php but 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  in your wiki directory.

Don't forget to clear your browser cache after you change your settings.

Does MediaWiki automatically capitalize the first letter of $wgSitename?
Yes. This can be changed using the $wgCapitalLinks configuration setting.

How do I make external links open in a new window?

 * See Opening external links in a new window

How can I suppress MediaWiki from formatting URLs, tags, etc?
Put "  " tags around the URL or tag.

Example: svn co http://svn.example.com/myproject/

Produces: svn co http://svn.example.com/myproject/

How can I force users to preview before they save?

 * See: Manual:Force preview and Extension:ForcePreview

How do I add more buttons on the edit page?

 * See: Manual:Custom edit buttons

How can I get more special characters or tags clickable on the edit page?
For adding more selectable special characters, etc., below the edit field, see Extension:CharInsert.

How can I use Wikipedia's default skin (Vector) on my wiki?
Vector was introduced in MediaWiki version 1.16, and was made the default skin in 1.17. See Manual:$wgDefaultSkin for more information on configuring your default skin.

Additional features of the Vector skin are made available using the Vector extensions, which you must download and install separately.

How do I disable external links from showing in the printable version of a page?
Edit the page MediaWiki:Print.css on your wiki and add the following code there:

This will override the styles defined in skins/common/commonPrint.css in MediaWiki source code. For more information, see Manual:CSS.

If instead you want to have the external links underlined in the printable version, then also add the following code:

How do I change the text of the article (page name) tab of my wiki's main page?
To change the text of the tab, as one example used in Wikipedia, you first open the page " ".

After you've done that, click Edit and type in the edit box the text you want to be seen later on the main page - that's it. Don't forget to save the page as well.

How do I edit a page?
To edit a page, simply click the edit link that appears on each page. Using the default Vector skin, this is in the form of a tab at the top of the page. A form will appear, containing the existing markup. When you have finished making modifications, click the Save button to commit your changes.


 * See also: Help:Editing pages

How do I create a new page?
There are several ways to create a new page:

On some wikis, a failed search for a page will contain a link which allows you to edit that page.
 * Create a link to the page on another page, then click on the red link which appears
 * Browse to the intended location of the page, e.g.  and click on the "Edit", "Create" or "Create source" link.


 * See also: Help:Starting a new page

How do I delete an old version of a page?
Old versions of page data are retained in the database and can be accessed via the page history features. This is useful for reviewing changes and correcting or reverting undesirable ones, but in some cases, administrators might want to make this information unavailable, for legal reasons, or to reduce the size of the database.


 * Administrators can delete an old revision of a page by deleting the page, and then selectively undeleting revisions to be kept
 * The Oversight extension (also known as HideRevision) can be used to move harmful revisions out of page histories on older versions of MediaWiki (<1.16).
 * For newer MediaWikis (1.14+), you can enable the core RevisionDelete feature that allows privileged users to remove single revisions from page histories.
 * The  maintenance script can mass-delete all old revisions of pages and their associated text records.


 * See also: Manual:Removing embarrassment

How do I use oversight/delete revisions in the page history?

 * See: RevisionDelete

You can also delete a page, and then restore only the revisions you want.

Are there any editing tutorials available?
There are several editing tutorials available, mostly on Wikimedia sister projects, such as Wikipedia. There are also markup references, etc. available on Meta.


 * The page Help:Editing pages on this site
 * Editing help content on Meta
 * The How to edit a page guide on the English Wikipedia

How do I view the printable form of a page?
MediaWiki includes stylesheets which automatically style a page appropriately when it is printed; using the print or print preview function within your browser ought to render the page in a printable form.

You can also view this printable form using the printable version link in the sidebar under Toolbox or Print/export if using the Collection extension.

How do I use templates?

 * See Help:Templates

Can I use media (images, video, audio, etc.) from Wikimedia Commons in my installed version of MediaWiki?
Yes, this is encouraged through the use of Manual:$wgUseInstantCommons.


 * See also: InstantCommons

How do I use a template as a signature?
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  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
 * 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, which looks a lot cleaner, then you need to use the two-page structure.

How do I add the sandbox functionality to my installation of the wiki?
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 add a "Sandbox" link to personal tools (top right)?
You need to add the Gadget extension and add the Sandbox gadget. You will probably also want to make it a default gadget.

How do I make my wiki serve all languages?
To make your wiki multilingual and a tool for translation, allowing translation of pages and of the custom interface (like the sidebar), use the Translate extension; there's extensive documentation.

Importing from MediaWiki XML dumps

 * See Manual:Importing XML dumps

Importing from other types of wiki software
Note: The following is directly copied from old meta FAQ. It might need to be corrected.

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?

Then,

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 http://www.yourwiki.org/uploads/filename

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

mysql -u -p < ImportStage3.txt

Note: If your  outputs an XML file instead of SQL statements, this probably means you have a rather new version of MediaWiki. In such a case, you can 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.

Importing from other types of files
There are a variety of tools available to help convert content from HTML (and other formats) to MediaWiki markup.


 * Developer and SysAdmin tools
 * HTML::WikiConverter::MediaWiki - a Perl module for converting from HTML to MediaWiki markup.
 * Wikificator - a Javascript MediaWiki extension that converts XHTML to MediaWiki markup.
 * The Edit.php, importImages.php and ImportTextFile.php maintenance scripts can be used to import text and images into MediaWiki.


 * End-user tools
 * HTML to Wiki Converter - an online HTML to MediaWiki markup conversion service. (Based on HTML::WikiConverter::MediaWiki)
 * wikEd - a text editor for MediaWiki that can import HTML (including Microsoft Word-generated HTML.)


 * Instructions
 * Brief notes on converting from Microsoft .chm help files to MediaWiki
 * Notes on converting from Microsoft Office formats to MediaWiki

MediaWiki auto importing script
Taken from wiki_import - MediaWiki auto import script:

Description
The script is designed to import a whole folder of files into MediaWiki, with the folder directory tree mapped as wiki category hierarchy.

Features

 * economic, build wiki site from existing knowledge base collection without "double-entry"
 * persistent, map folder directory tree as wiki category hierarchy
 * sophisticated, import/handle all well-known file types automatically
 * complete, cover every applicable scenario, even the case when you need to control access to individual wiki pages
 * versatile, highly customizable

Quick Help
wiki_import.sh $ $Revision: 1.1 $

mediawiki automatic file import script

Usage: wiki_import.sh [OPTIONS]...

The script is designed to import a whole folder of files into mediawiki, with the folder directory tree mapped as wiki category hierarchy.

The specification of the file-to-import is passed from standard input.

Options: -s, --sect=n    the root category section of the wiki of the imported article (mandatory) -1, --header    include standard header (category hierarchy path & notice) -l, --link      link to actual file on the web site -f, --footer    include standard footer (article category) -R, --res[=p]   add restricted tag in the footer as '' (default=`$_opt_sect')

Configuration Options: -p, --php=fn    mediawiki import php script specification -r, --root=n    the root category name for the whole wiki site -m, --max=n     max_allowed_packet for mysqld to import -u, --user=n    wiki user used for the import -a, --arch=p    the root url that linked-to archive files based on

Examples:

echo ./path/to/file.ext | wiki_import.sh -1 -l -f -s 'Customer Support' -R

For the rest of details, check out wiki_import.

Templates imported from other wikis (such as Wikipedia) don't work for me
You probably need to install some extensions used on the source wiki, such as ParserFunctions or sometimes Cite. Also, make sure that you copied all site CSS and JavaScript required by the template.

I want to have multiple wikis, but only require registration once

 * If you're starting from scratch or you're switching from one wiki to multiple, you can use $wgSharedDB and $wgSharedTables to have all wikis share the user table of the "main" wiki. You can share other tables as well, as long as they don't contain any data dependent on non-shared tables or data specific to one wiki. See Manual:Shared database for examples and more information.
 * If your wikis are already established and you want to switch to a single sign-on, you can use the CentralAuth extension. It has a few more features than a shared user table, but it's more difficult to configure and it's tailored toward a Wikimedia-style setup. However, it is easier than attempting to completely merge multiple user tables into one.

How can I allow use of HTML tags?
See Manual:$wgRawHtml as well as Manual:$wgGroupPermissions and Manual:Preventing access.

See Extension:SecureHTML and Extension:HTMLets for ways to make this safer.

How do I fix problems or add features to MediaWiki?
The basic steps to improving MediaWiki (that is, becoming a MediaWiki developer) are:


 * Install Git
 * Download the Git "clone" of the MediaWiki source code
 * Get a server, a database, and PHP running on your computer (this can be annoying, so please ask for help if something isn't working)
 * Get MediaWiki running on your computer off that Git checkout (can be annoying as well, so, ditto)
 * Fix the problem or add the feature you were thinking of, or if you don't have one in mind, look at one of the "annoying little bug"s
 * Edit the source code of the relevant file(s) to fix the problem
 * Follow Gerrit/Tutorial

How do I run a bot?

 * See Manual:Bots

You might want to use the Pywikibot framework.

How do I change noindex nofollow
Set  in LocalSettings.php

How do I create a small wiki farm?

 * See: Manual:Wiki family

How do I add meta tags?
The OutputPage class includes an addMeta methods which can be used to add meta tags. The RequestContext can be used to get the relevant OutputPage object.

To add further Meta tags just add further lines as last lines of the function addMetaTags like:

$out->addMeta ( 'description', 'This is a meta description.' );

…is the Help namespace empty?
The Help namespace currently ships in a blank state. It's up to you how much or how little help you give to your site visitors and whether this relates to other aspects of your site. Obviously you can easily link your visitors to help resources elsewhere.

We don't currently have a clean, internationalised set of help pages under a free license. However, if you want to copy in some help information onto your site, about how to use a wiki (a MediaWiki powered wiki) you are free to copy the Help:Contents from this wiki. This set of pages have been deliberately created for this purpose, with wiki-neutral information, and no license restrictions. See Project:PD help. More help is available at the Meta-Wiki MediaWiki Handbook.

…are some of my images not showing up after an upgrade?
Several users have reported that, following an upgrade or a moving of their wiki, several images fail to be shown inline. The files exist, and the image description pages show a MIME type of  and, in some cases, a warning about potentially dangerous files.

To fix this, run the  script from the command line. This will set MIME information for each file in the database.

…are all PNG files not being turned into thumbnails?
After upgrading to a more recent version of PHP, it is possible a different MimeMagic.php function is being used to detect file MIME types, particularly the built-in PHP function mime_content_type, which fails to detect PNG files. Search the web for mime_content_type png for information on fixing this bug at the PHP level, possibly by editing your magic.mime file.

See here for more info.

…is a search for a short keyword giving no hits?
By default, MediaWiki uses MyISAM's fulltext matching functionality to allow searching page content. The default settings for this mean that words of less than four characters won't be indexed, so will be ignored in searches with older versions of MediaWiki.

MediaWiki 1.13 and earlier are unable to work around this; you must either change MySQL's configuration to index shorter words, or upgrade to a more recent version of MediaWiki.

Note that some particular words may still not be indexed if they are in MySQL's default stopword list.

…can't I download MediaWiki {{#expr:{{MW stable branch number}}+.01}}?
MediaWiki 0000 is in a development state at present, and has not been packaged into a general release. The code can be downloaded from Git if desired. Or, if you want the latest development version packaged as an archive, get it at.

…doesn't this work? It works on Wikipedia!
Wikipedia and other Wikimedia web sites use the current version of the code in development; at present, this is MediaWiki, pulled from the current development branch. Coupled with the use of several extensions, this means that functionality between these wikis and your particular setup may differ.


 * To obtain the current development code, read Download from Git
 * To check what version a Wikimedia wiki is running, as well as what extensions are installed, visit the Special:Version page for that wiki

…do I get a 403 Forbidden error after setting permissions on my Fedora system?
Fedora Core enables SELinux by default. Instructions for setting SELinux permissions for MediaWiki are available.

…do I get logged out constantly?
This is probably related to cookies or session data, for example a problem with PHP's session.save_path setting. See Log in problems for information.

…doesn't my wiki work on Sourceforge?

 * See Manual:Installing MediaWiki on SourceForge.net.

…is it a good idea to keep user accounts?
At many times you just want to remove a user account out of the wiki either because it belonged to a spammer account or you just feel like it. The appropriate choice is to block the account or rename it if needed. Here is why:

Do I just remove his row from the User table?

Rob Church posted the following regarding this issue on the mediawiki-l mailing list:

"If the user has made edits, then removing rows from the user table cause theoretical loss of referential integrity. Now, to be honest with you, I can't think of any conditions where this would cause an actual problem; "undefined behaviour" is the phrase we use.

What I'd suggest doing, to be on the safe side, is running a couple of quick updates against the database:



What this will do is cause MediaWiki to treat the revisions as having been made anonymously when generating things like page histories, which should eliminate any problems caused by these routines attempting to check user details from other tables.

If the user has caused log entries, i.e. rows in the logging table, or uploaded images, then the situation becomes trickier, as you'll have to start mopping up all the rows everywhere and it could become a bit of a mess, so if the user's done anything other than edit, I would strongly recommend just blocking them indefinitely.

If the username is offensive or undesirable, then you could consider renaming it using the RenameUser extension."

Another option is to give Admins the 'hideuser' right, and indefinitely block the user with the Hide username from edits and lists option selected.

Extension:UserMerge is also useful.

Where do I get the spam blacklist from and how do I install it?
The spam blacklist extension can be found in Git, just like all other officially supported extensions. For installation and configuration instructions, consult the file and extension page over here.

How do I use $wgSpamRegex to block more than one string?
$wgSpamRegex (see Manual) is a powerful filter for page content. Adding multiple items to the regex, however, can be awkward. Consider this snippet:

This example code allows convenient addition of additional items to the regex without fiddling about each time. It also demonstrates two popular filters, which block some of the most common spam attacks.


 * See also: Extension:SpamRegex

Are there additional ways to fight spam?
See Manual:Combating spam for an overview of anti-spam measures such as Captcha, content filtering and restricting edition.

Anti-vandalism
See Manual:Combating vandalism for hints and suggestions on how to deal with wiki vandalism.

I've found a bug or have a feature request. Where do I post it?
Bugs and feature requests should be posted on Phabricator. See How to report a bug.

I'm getting a strange error. What now?

 * See if it is covered by Manual:Errors and Symptoms
 * Try to find out more about the problem, see How to debug MediaWiki
 * See the section below for information on how to contact developers and other knowledgabe users.

I tried that but it didn't work

 * 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 . 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, not to the beginning.
 * If you created a .htaccess, are you sure AllowOverrides is on? Ask your hosting provider.

I have a question not answered here. Where do I go next?
If you've exhausted the FAQ above, please try the following:


 * Check the other sources of help on this site
 * Search the rest of this site
 * Search older documentation archived on Meta; Useful developer documentation remains on Meta.wikimedia.org in the category Pages to be exported to MediaWiki.org until the m:Meta:MetaProject to transfer content to MediaWiki.org completes
 * Search the web
 * Dig into the source
 * See the section below for information on how to contact developers and other knowledgeable users.

Still no luck. Where can I ask for help?

 * Post a message at Project:Support desk
 * Email the mediawiki-l mailing list (try and search the archive first).
 * Ask the developers in our IRC channel.

Recommended reading

 * Asking smart questions
 * Effective bug reporting
 * Getting help on IRC
 * Books about MediaWiki