User:Krams036/WikiFarm Setup
Creating a Wiki Farm using a single source code for multiple Mediawiki sites
Setting Up .htaccess[fetola | fetola mohloli]
Save a .htaccess file in the root directory of your site. The contents should look like this.
## https://www.mediawiki.org/wiki/Manual:Short_URL/Apache # Enable the rewrite engine RewriteEngine On # Short URL for wiki pages RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/qazvin/index.php [L] RewriteRule ^/?qazvin1(/.*)?$ %{DOCUMENT_ROOT}/qazvin/index.php [L] # Redirect / to Main Page RewriteRule ^/*$ %{DOCUMENT_ROOT}/qazvin/index.php [L]
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/qazvin/index.php [L]
redirects request using /wiki to the installation folder
Setting up Main LocalSettings.php[fetola | fetola mohloli]
Create a file title LocalSetting.php in the root of the installation folder. This will redirect
<?php // Include common settings to all wikis before this line (eg. database configuration) $callingurl = strtolower( $_SERVER['REQUEST_URI'] ); // get the calling url if ( strpos( $callingurl, '/wiki' ) === 0 ) { require_once 'LocalSettings_wiki.php'; } elseif ( strpos( $callingurl, '/qazvin1' ) === 0 ) { require_once 'LocalSettings_qazvin.php'; } else { # header( 'HTTP/1.1 404 Not Found' ); # echo "This wiki (\"" . htmlspecialchars( $callingurl ) . "\") is not available. Check configuration."; header('location:/w/'); exit( 0 ); }
Additional Settings in individual Wiki LocalSetting.php[fetola | fetola mohloli]
## The URL base path to the directory containing the wiki; ## defaults for all runtime URL paths are based off of this. ## For more information on customizing the URLs please see: ## http://www.mediawiki.org/wiki/Manual:Short_URL $wgScriptPath = "/qazvin"; $wgScript = "/wiki/index.php"; $wgRedirectScript = "/wiki/redirect.php"; $wgArticlePath = "/wiki/$1"; $wgScriptExtension = ".php"; $wgUsePathInfo = true;