User:Rehman/MediaWiki
Over the next few months, I plan on doing some demos on how organisations can use MediaWiki. This page is where I will be storing my own notes (hence it will look messy/incomplete).
The demos will be done on https://wiki.rehman.website/. All uploaded content are dummy content, and the main domain and subdomains were purchased with the intention of being disposable.
Quick links and notes[edit]
- Pre-install checks:
- Clear old files from domain/subdomains/directories
- Clear old database/users as required
- Recheck SSL
- Download → Installation guide → Config script → System administration → Upgrading → Uninstallation
- Ideal root folder setup (on shared server):
home/<user>/subdomain.domain.com/root/
- Install MediaWiki in a subdirectory (
/w
):home/<user>/subdomain.domain.com/root/w/
(public:subdomain.domain.com/w/
)- Never install in
/wiki
subdirectory; use/w
or anything else
- Never install in
- Files and/or deleted files could be located outside the root:
home/<user>/subdomain.domain.com/images/deleted
- Install MediaWiki in a subdirectory (
- Before running MediaWiki installer. Consider extracting all required extensions, so that they may all be installed at once automatically.
Extensions[edit]
Extensions included within MW 1.35.0[edit]
The below extensions come with the main MediaWiki installer (v1.34.2). Install all of them (as some of them requires others):
Suggested extensions[edit]
|
|
|
Private wiki[edit]
Restricting access within MediaWiki[edit]
See Manual:Preventing access. The below are automatically set when selecting "Private wiki" during install.
- Disable reading by anonymous users:
$wgGroupPermissions['*']['read'] = false;
- Disable anonymous editing:
$wgGroupPermissions['*']['edit'] = false;
- Prevent new user registrations except by sysops:
$wgGroupPermissions['*']['createaccount'] = false;
Restriction direct access to uploaded files[edit]
See Manual:Image authorization
- Add
Deny from All
in the.htaccess
file located in the/images
directory - Add
$wgUploadPath = "{$wgScriptPath}/img_auth.php";
to LocalSettings.php
Block malicious files (suitable if users and untrusted/unknown): Manual:Security#Upload security
Restricting bots crawling on the site[edit]
- Create a
robot.txt
file in the web root - Add the below lines within the file:
User-agent: *
Disallow: /
Also add $wgDefaultRobotPolicy = 'noindex,nofollow';
Other settings or notes[edit]
Hide index.php from URL[edit]
See Manual:Short URL and/or Manual:Short URL/Apache#Simple instructions.
.htaccess:
RewriteEngine On
# main rewrite rule
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
LocalSettings.php:
$wgScriptPath = "/w";
$wgArticlePath = "/wiki/$1";
Updating the logo[edit]
Read more at Manual:FAQ#How do I change the logo?
# Update site logo (default path will be overridden during upgrade)
$wgLogo = "{$wgUploadPath}/6/62/mylogo.png";
Updating the favicon[edit]
Read more at Manual:FAQ#How do I change the icon in the browser's address line (favicon)?
Automatic double-redirect fix[edit]
# Fix double redirects after a page move. Edits by Redirect_fixer account name.
$wgFixDoubleRedirects = true;
Adding more file types[edit]
# Add more file types to the default array
$wgFileExtensions = array_merge(
$wgFileExtensions, [
'pdf', 'ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx', 'svg', 'oft'
]
);
- To avoid the error
File extension ".oft" does not match the detected MIME type of the file (application/sla)
for.oft
files, changeapplication/sla stl
toapplication/sla stl oft
in/includes/libs/mime/mime.types
.
Amend poweredby and copyright logos[edit]
# Amend both poweredby and copyright logos
$wgFooterIcons = [
"copyright" => [
"copyright" => [
"src" => "/resources/assets/example_logo.png",
"url" => "https://www.example.com/",
"alt" => "Example text",
]
],
"poweredby" => [
"mediawiki" => [
// Defaults to point at
// "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png"
// plus srcset for 1.5x, 2x resolution variants.
"src" => null,
"url" => "https://www.mediawiki.org/",
"alt" => "Powered by MediaWiki",
]
],
];
Customising the sidebar[edit]
See Manual:Interface/Sidebar. Example:
Changing the Main page[edit]
- Rename the page to the desired name, and update MediaWiki:Mainpage
- Hide the page title? Use
{{DISPLAYTITLE:<span style="opacity:0;position:absolute;">{{FULLPAGENAME}}</span>}}
Creating custom namespaces[edit]
Creating custom usergroups and rights[edit]
Modify password policy[edit]
[edit]
Disable caching[edit]
$wgParserCacheType = CACHE_NONE;
Others[edit]
- Cpanel: Setup email and/or forwarders for the $wgPasswordSender
- Cpanel: Disable index viewing
- Cpanel: Enable hotlink protection
MediaWiki interface pages[edit]
- See Special:AllMessages for all system messages (MediaWiki.org examples)
To do[edit]
- Manual:User rights
- How to setup pages like https://en.wikipedia.org/w/docs