Difference between revisions of "Personalize MediaWiki"

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== Move the installation directory ==
 
== 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.
+
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.
  
 
<pre>
 
<pre>
Line 10: Line 10:
 
This is to hide a tab on all pages. Note that hiding tab does not prevent from accessing the page.
 
This is to hide a tab on all pages. Note that hiding tab does not prevent from accessing the page.
  
* Update MediaWiki:Common.css.
+
* Update '''MediaWiki:Common.css'''.
 
<pre>
 
<pre>
 
/* Hide [Watch] tab */
 
/* Hide [Watch] tab */
Line 28: Line 28:
 
Reference: http://www.mediawiki.org/wiki/Manual:$wgFavicon<br>
 
Reference: http://www.mediawiki.org/wiki/Manual:$wgFavicon<br>
 
Use the free icon generator web site like http://www.favicon.cc/.
 
Use the free icon generator web site like http://www.favicon.cc/.
 +
 +
== Google AdSense extension ==
 +
Reference: http://www.mediawiki.org/wiki/Extension:Google_AdSense_2<br>
 +
 +
== Short URL ==
 +
References:<br>
 +
http://www.mediawiki.org/wiki/Manual:Short_URL<br>
 +
http://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_title_--_PHP_as_a_CGI_module,_no_root_access<br>
 +
Sample of the default page address
 +
: <code><nowiki>http://website.com/wiki/index.php?title=Page_title</nowiki></code>
 +
The Short URL version of above is
 +
: <code><nowiki>http://website.com/wiki/Page_title</nowiki></code>
 +
Sample here is for 1and1 hosting using PHP as a CGI module with no root access.
 +
<br>
 +
* Update the '''LocalSettings.php'''.
 +
 +
<pre>
 +
$wgScript          = "$wgScriptPath/index.php";
 +
$wgRedirectScript  = "$wgScriptPath/redirect.php";
 +
$wgArticlePath      = "$wgScriptPath/$1";
 +
$wgUsePathInfo      = false;   
 +
</pre>
 +
* Update the '''.htaccess''' file in the web root where the MediaWiki is installed.
 +
<pre>
 +
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]
 +
</pre>

Revision as of 16:51, 6 March 2011

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/.

Google AdSense extension

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

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

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]