Manual:Short URL/Ignoring the Trailing slash

From MediaWiki.org

Jump to: navigation, search

[edit] Ignoring the Trailing slash

When a page is accessed with a trailing slash MediaWiki sees it as a different page - (Named Page/ instead of Page). You may want to consider this solution.

[edit] ~/web_root/.htaccess

Options FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [L,QSA]

[edit] ~/web_root/LocalSettings.php

$wgArticlePath = "$wgScriptPath/$1";
$GLOBALS['_REQUEST']['title'] = preg_replace("/^(.+)\/$/", "$1", $GLOBALS['_REQUEST']['title']);
Personal tools