Configuring $wgArticlePath for Short URL Implementation

How does the $wgArticlePath variable in LocalSettings.php work in tandem with web server rewrite rules to enable ‘Short URLs’ like /wiki/Page_Name?

Hi @EmberVax

The relationship is a coordinated handoff. In LocalSettings.php, $wgArticlePath (e.g., /wiki/$1) instructs MediaWiki to generate “pretty” links for all internal navigation. However, the directory /wiki/ does not physically exist.

To resolve this, you must configure web server rewrite rules (in Apache or Nginx). These rules catch incoming requests for /wiki/Page_Name and internally redirect them to the actual entry point: index.php?title=Page_Name.

Together, they bridge the gap: $wgArticlePath handles the outbound appearance of links, while server rewrites handle the inbound processing of those requests.

Thanks for this valuable information sir.