Short URL

From mw.mh370.wiki
Jump to navigation Jump to search


A Guide to Using MediaWiki in a Hosted Environment

An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.


URLs

The default page URL for a MediaWiki-based webpage includes an unwanted path /w/index.php?Title= and the goal is to make that 'pretty' or 'short' by substituting the default path with /wiki.

Two articles explain this in more depth:-

  1. Short URL - covers the common process for rewriting /w/index.php?Title= as /wiki
  2. Short URL for .wiki Domain - covers the special case of a MediaWiki-based website with a top-level domain .wiki, such as this website. To avoid a URL with .wiki/wiki the .htaccess file and configuration in LocalSettings.php must be different from option 1.

See also .htaccess.


Default URL

The default URL shows the domain name / the installation directory (w) / the file index.php / and the current page Main_Page.

For example, when this website was installed the URL for the Main Page was mw.mh370.wiki/w/index.php/Main_Page.

Short URL

To shorten the URL requires commands in the .htaccess file which match a configuration in the LocalSettings.php file.

Source: https://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_Title_--_.htaccess

The matching configuration in LocalSettings.php is:-

$wgScriptPath  = "/w";
$wgArticlePath = "/wiki/$1";

The result is a 'Short URL'.

This will suit most installations of MediaWiki, and is therefore most common - MediaWiki-based websites usually have /wiki/ in the URL.

Related Articles

Short URL for .wiki Domain
If the top-level domain is .wiki even a 'short URL' would look a bit strange with .wiki/wiki, but that can be changed.


Articles which relate to Short URL

Articles which relate to Short URL are included in Category:Short URL.

The CategoryTree Extension enables a listing of relevant sub-categories and pages:-



Links

Manual:Short URL
https://www.mediawiki.org/wiki/Manual:Short_URL
Manual:$wgArticlePath
https://www.mediawiki.org/wiki/Manual:$wgArticlePath
Manual:$wgScriptPath
https://www.mediawiki.org/wiki/Manual:$wgScriptPath
Manual:$wgActionPaths
https://www.mediawiki.org/wiki/Manual:$wgActionPaths
Manual:Short URL/wiki/Page Title -- .htaccess
https://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_Title_--_.htaccess