Difference between revisions of "Personalize MediaWiki"
| (22 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| + | == 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. | ||
| + | |||
| + | <pre> | ||
| + | $wgScriptPath = "/wiki"; | ||
| + | </pre> | ||
| + | |||
== Hide tabs == | == Hide tabs == | ||
Reference: http://www.mediawiki.org/wiki/User:Subfader/Hide_page_tabs<br> | Reference: http://www.mediawiki.org/wiki/User:Subfader/Hide_page_tabs<br> | ||
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 17: | Line 24: | ||
#ca-talk { display: none !important; } | #ca-talk { display: none !important; } | ||
</pre> | </pre> | ||
| + | |||
| + | == Change Favicon == | ||
| + | Reference: http://www.mediawiki.org/wiki/Manual:$wgFavicon<br> | ||
| + | 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<br> | ||
| + | |||
| + | == Use 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 is | ||
| + | : <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> | ||
| + | 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 | ||
| + | |||
| + | == Restrict account creation == | ||
| + | Reference: http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_account_creation | ||
| + | |||
| + | == Integrate Google Analytics == | ||
| + | http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration | ||
| + | |||
| + | == Allow External Websites == | ||
| + | This will allow '''ANY''' external image URLs. | ||
| + | <pre> | ||
| + | $wgAllowExternalImages = true; | ||
| + | </pre> | ||
| + | |||
| + | But the better approach is to limit the access using the white list. | ||
| + | <pre> | ||
| + | $wgAllowExternalImages = false; | ||
| + | $wgEnableImageWhitelist = true; | ||
| + | </pre> | ||
| + | http://www.mediawiki.org/wiki/Manual:$wgEnableImageWhitelist | ||
| + | |||
| + | == Change the default skin == | ||
| + | <pre> | ||
| + | ## Default skin: you can change the default skin. Use the internal symbolic | ||
| + | ## names, ie 'vector', 'monobook': | ||
| + | $wgDefaultSkin = 'vector'; | ||
| + | #$wgDefaultSkin = 'monobook'; | ||
| + | </pre> | ||
| + | |||
| + | == Add embedded videos == | ||
| + | http://www.mediawiki.org/wiki/Extension:EmbedVideo | ||
| + | |||
| + | == Change font size of pre == | ||
| + | Edit MediaWiki:Common.css with: | ||
| + | pre { font-size: 100%; } | ||
| + | |||
| + | == Mobile-device detection == | ||
| + | http://www.mediawiki.org/wiki/Extension:MobileDetect | ||
| + | <pre> | ||
| + | ## Default skin: you can change the default skin. Use the internal symbolic | ||
| + | ## names, ie 'vector', 'monobook': | ||
| + | require_once("$IP/extensions/MobileDetect/MobileDetect.php"); | ||
| + | $mobile = mobiledetect(); | ||
| + | if ($mobile == false) $wgDefaultSkin = "vector"; # If not Mobile | ||
| + | if ($mobile == true) $wgDefaultSkin = "chick"; # If is Mobile | ||
| + | </pre> | ||
| + | |||
| + | |||
| + | [[Category:Web_Site]] | ||
Latest revision as of 10:45, 24 February 2012
Contents
- 1 Move the installation directory
- 2 Hide tabs
- 3 Change Favicon
- 4 Use Google AdSense extension
- 5 Use Short URL
- 6 Add custom error-landing page
- 7 Restrict anonymous editing
- 8 Restrict account creation
- 9 Integrate Google Analytics
- 10 Allow External Websites
- 11 Change the default skin
- 12 Add embedded videos
- 13 Change font size of pre
- 14 Mobile-device detection
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
Restrict account creation
Reference: http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_account_creation
Integrate Google Analytics
http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration
Allow External Websites
This will allow ANY external image URLs.
$wgAllowExternalImages = true;
But the better approach is to limit the access using the white list.
$wgAllowExternalImages = false; $wgEnableImageWhitelist = true;
http://www.mediawiki.org/wiki/Manual:$wgEnableImageWhitelist
Change the default skin
## Default skin: you can change the default skin. Use the internal symbolic ## names, ie 'vector', 'monobook': $wgDefaultSkin = 'vector'; #$wgDefaultSkin = 'monobook';
Add embedded videos
http://www.mediawiki.org/wiki/Extension:EmbedVideo
Change font size of pre
Edit MediaWiki:Common.css with:
pre { font-size: 100%; }
Mobile-device detection
http://www.mediawiki.org/wiki/Extension:MobileDetect
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
require_once("$IP/extensions/MobileDetect/MobileDetect.php");
$mobile = mobiledetect();
if ($mobile == false) $wgDefaultSkin = "vector"; # If not Mobile
if ($mobile == true) $wgDefaultSkin = "chick"; # If is Mobile