User:Krams036/ShortUrl Setup

E tswa ho Wikipedia

Steps in setting up a short url for Mediawiki sites

Create a .htaccess file[fetola | fetola mohloli]

Create a .htaccess file in the root directory of your website. This 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]

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/qazvin/index.php [L]

The contents of the website can be accessed using /wiki example http://razini.atwebpages.com/wiki/Main_Page

Setting up LocalSettings.php[fetola | fetola mohloli]

Look for the section of the LocalSettings.php where $wgScriptPath and update the contents to something like this.

## 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;

Additional Source[fetola | fetola mohloli]