Extension:NamespacePaths
![]() Release status: stableCategory:Stable extensions |
|
---|---|
Description | Allows custom article paths to be mapped to namespaces of the wiki |
Author(s) | Daniel Friesen @ Redwerks (Dantmantalk) |
Latest version | 1.2.0 (2022-10-07) |
MediaWiki | 1.35+Category:Extensions with manual MediaWiki version |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | Category:Extensions in Wikimedia version control |
$wgNamespacePaths |
|
Quarterly downloads | 1 (Ranked 114th) |
Translate the NamespacePaths extension if it is available at translatewiki.net |
The NamespacePaths extension extends custom article paths to allow namespaces to be mapped to extra paths separate from the article path. For example mapping the help namespace to /help/$1
so pages like "Help:Contents" go to /help/Contents
.
Installation
- Download and move the extracted
NamespacePaths
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/NamespacePaths - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'NamespacePaths' );
- Configure the
$wgNamespacePaths
with the paths you want to use for namespaces, the key is the namespace id (you can use the NS_ constants), and the value is a$wgArticlePath
style string like "/help/$1". - Configure your webserver to pass the extra paths to MediaWiki. Consult the short URL documentation you set the article paths for your wiki and extend it to map the extra paths to "index.php".
- Note: You don't want to try mapping things to
⁄index.php?title=$1
, doing so will break the paths. If you just make sure that⁄index.php
is run for these extra article paths as long as your webserver setsREQUEST_URI
correctly the extension will take it from there and extract the correct title on it's own.
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed. Category:Extensions still supporting pre-registration versions
To users running MediaWiki 1.39 or earlier:
The instructions above describe the new way of installing this extension using wfLoadExtension()
.
If you need to install this extension on these earlier versions (MediaWiki 1.39 and earlier), instead of wfLoadExtension( 'NamespacePaths' );
, you need to use:
require_once "$IP/extensions/NamespacePaths/NamespacePaths.php";
Category:All extensions
Category:Extensions in Wikimedia version control
Category:Extensions still supporting pre-registration versions
Category:Extensions with invalid or missing type
Category:Extensions with manual MediaWiki version
Category:Extensions without a compatibility policy
Category:Extensions without an image
Category:GPL licensed extensions
Category:GetLocalURL::Article extensions
Category:Stable extensions
Category:WebRequestPathInfoRouter extensions