Personalize MediaWiki

From Ittichai Chammavanijakul's Wiki
Revision as of 17:00, 6 March 2011 by Ittichai (talk | contribs)
Jump to navigation Jump to search

Move the installation directory

The MediaWiki does not record the installation path in the database. If the directory is moved or changed, just simply update the $wgScriptPath in the LocalSettings.php file.

$wgScriptPath       = "/wiki";

Hide tabs

Reference: http://www.mediawiki.org/wiki/User:Subfader/Hide_page_tabs
This is to hide a tab on all pages. Note that hiding tab does not prevent from accessing the page.

  • Update MediaWiki:Common.css.
/* Hide [Watch] tab */
#ca-watch { display: none !important; }

/* Hide [History] tab */
#ca-history { display: none !important; }

/* Hide [View Source] tab */
#ca-viewsource { display: none !important; }

/* Hide [Discussion] tab */
#ca-talk { display: none !important; }

Change Favicon

Reference: http://www.mediawiki.org/wiki/Manual:$wgFavicon
Use the free icon generator web site like http://www.favicon.cc/.

Use Google AdSense extension

Reference: http://www.mediawiki.org/wiki/Extension:Google_AdSense_2

Use Short URL

References:
http://www.mediawiki.org/wiki/Manual:Short_URL
http://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_title_--_PHP_as_a_CGI_module,_no_root_access
Sample of the default page address is

http://website.com/wiki/index.php?title=Page_title

The Short URL version of above is

http://website.com/wiki/Page_title

Sample here is for 1and1 hosting using PHP as a CGI module with no root access.

  • Update the LocalSettings.php.
$wgScript           = "$wgScriptPath/index.php";
$wgRedirectScript   = "$wgScriptPath/redirect.php";
$wgArticlePath      = "$wgScriptPath/$1";
$wgUsePathInfo      = false;     
  • Update the .htaccess file in the web root where the MediaWiki is installed.
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wiki/index.php?title=$1 [L,QSA]

Note that AddType and AddHandler are added because by default 1and1 will handle the .php file with PHP4 - http://faq.1and1.com/archive/44.html

Add custom error-landing page

Reference: http://faq.1and1.com/scripting_languages_supported/configuring_apache_server_using_htaccess/2.html

Restrict anonymous editing

Reference: http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_anonymous_editing