LocalSettings.php中设置:
$wgExternalLinkTarget = ‘_blank’;
外链不包括interwiki链接
原文永久链接:https://jijian91.com/blog20111028/mediawiki-blank-link.html
LocalSettings.php中设置:
$wgExternalLinkTarget = ‘_blank’;
外链不包括interwiki链接
原文永久链接:https://jijian91.com/blog20111028/mediawiki-blank-link.html
只允许管理员代为注册,在LocalSettings.php中增加:
$wgGroupPermissions = array();
$wgGroupPermissions[‘*’ ][‘createaccount’] = false;
$wgGroupPermissions[‘*’ ][‘read’] = true;
$wgGroupPermissions[‘*’ ][‘edit’] = false;
$wgGroupPermissions[‘*’ ][‘createpage’] = false;
$wgGroupPermissions[‘*’ ][‘createtalk’] = false;
$wgGroupPermissions[‘user’ ][‘move’] = true;
$wgGroupPermissions[‘user’ ][‘read’] = true;
$wgGroupPermissions[‘user’ ][‘edit’] = true;
$wgGroupPermissions[‘user’ ][‘createpage’] = true;
$wgGroupPermissions[‘user’ ][‘createtalk’] = true;
$wgGroupPermissions[‘user’ ][‘upload’] = true;
$wgGroupPermissions[‘user’ ][‘reupload’] = true;
$wgGroupPermissions[‘user’ ][‘reupload-shared’] = true;
$wgGroupPermissions[‘user’ ][‘minoredit’] = true;
$wgGroupPermissions[‘sysop’][‘block’] = true;
$wgGroupPermissions[‘sysop’][‘createaccount’] = true;
$wgGroupPermissions[‘sysop’][‘delete’] = true;
$wgGroupPermissions[‘sysop’][‘deletedhistory’] = true;
$wgGroupPermissions[‘sysop’][‘editinterface’] = true;
$wgGroupPermissions[‘sysop’][‘import’] = true;
$wgGroupPermissions[‘sysop’][‘importupload’] = true;
$wgGroupPermissions[‘sysop’][‘move’] = true;
$wgGroupPermissions[‘sysop’][‘patrol’] = true;
$wgGroupPermissions[‘sysop’][‘protect’] = true;
$wgGroupPermissions[‘sysop’][‘rollback’] = true;
$wgGroupPermissions[‘sysop’][‘upload’] = true;
$wgGroupPermissions[‘sysop’][‘reupload’] = true;
$wgGroupPermissions[‘sysop’][‘reupload-shared’] = true;
$wgGroupPermissions[‘sysop’][‘unwatchedpages’] = true;
$wgGroupPermissions[‘sysop’][‘autoconfirmed’] = true;
$wgGroupPermissions[‘bot’ ][‘bot’] = true;
$wgGroupPermissions[‘bot’ ][‘autoconfirmed’] = true;
原文永久链接:https://jijian91.com/blog20111024/mediawiki-prevent-registration.html
如mediawiki安装在wiki目录下,欲以“http://url/w/条目”的形式访问,则:
1. 在LocalSettings.php中设置:
$wgScriptPath = “/wiki”;
$wgArticlePath = “/w/$1”;
$wgUsePathInfo = true;
$wgScriptExtension = “.php”;
(或 $wgScriptExtension = “.php5”; ,根据实际情况)
2. 在网站根目录设置.htaccess
Apache版本:
RewriteEngine on
RewriteRule ^w/?(.*)$ /w/index.php?title=$1 [L,QSA]
Nginx版本:
rewrite ^/w/?(.*)$ /index.php?title=$1 last;
原文永久链接:https://jijian91.com/blog20111024/mediawiki-short-url.html
Mediawiki 1.17.0提供了generateSitemap.php生成sitemap文件,可不必再使用扩展。
每次调用generateSitemap.php,生成全部sitemap。一般是通过定时任务(Linux下是cron)调用,定时生成。
generateSitemap.php命令示例:
php /wiki/maintenance/generateSitemap.php –fspath /jijian91.com/sitemap/ –urlpath http://jijian91.com/sitemap/ –compress yes –server http://jijian91.com
其中,–fspath是存放sitemap文件的目录,–urlpath是指向–fspath目录的URL,–compress是是否压缩为gzip文件,–server是网站的域名。详细命令行参数见官方说明。
执行后,生成1个索引xml和一组sitemap xml。每个namespace至少生成1个sitemap xml,url超过限制则生成另一个xml,缺省限制是1个xml是50000。可根据需要向搜索引擎提交索引xml或若干sitemap xml。
如只生成部分namespace的sitemap,可在wiki/LocalSettings.php中设置:
$wgSitemapNamespaces[0]=0;
$wgSitemapNamespaces[1]=14;
0是主namespace,条目一般都在这里;14是分类的namespace。
生成的xml文件名很长,如想修改文件名规则,可修改/wiki/maintenance/generateSitemap.php的150行(索引xml)和352行(sitemap xml)。
如mediawiki已设置短URL,则sitemap中就是短URL。
原文永久链接:https://jijian91.com/blog20111024/mediawiki-sitemap.html
1. 隐藏“阅读”、“查看源代码”、“历史”,修改vector.php的735行:
<div id=”p-views” class=”vectorTabs<?php if count( $this->data[‘view_urls’] ) == 0 ) echo ‘ emptyPortlet’; ?>”>
改为:
<div id=”p-views” class=”vectorTabs<?php if ( !($this->data[‘loggedin’]) || count( $this->data[‘view_urls’] ) == 0 ) echo ‘ emptyPortlet’; ?>”>
2. 隐藏“编辑”、“讨论”,修改vector.php的700行:
<div id=”p-namespaces” class=”vectorTabs<?php if ( count( $this->data[‘namespace_urls’] ) == 0 ) echo ‘ emptyPortlet’; ?>”>
改为:
<div id=”p-namespaces” class=”vectorTabs<?php if ( !($this->data[‘loggedin’]) || count( $this->data[‘namespace_urls’] ) == 0 ) echo ‘ emptyPortlet’; ?>”>
3. 隐藏ip、ip讨论页、登录,修改761行:
<div id=”p-personal” class=”<?php if ( count( $this->data[‘personal_urls’] ) == 0 ) echo ‘ emptyPortlet’; ?>”>
改为:
<div id=”p-personal” class=”<?php if ( !($this->data[‘loggedin’]) || count( $this->data[‘personal_urls’] ) == 0 ) echo ‘ emptyPortlet’; ?>”>
原文永久链接:https://jijian91.com/blog20111021/mediawiki-remove-button.html