A better way to make very short URL for MediaWiki

No GoodNeed ImprovementOKGoodExcellent (No Ratings Yet)
Loading ... Loading ...

There are many articles on various web sites talking about shortening URL for mediawiki, but most of time, it does not work if you follow their instruction. Hours have passed by and you got so frustrated: we just need something simple and work. Afer hours of trials, I got the following to work:

1, In your http.conf file, under virtual host section add the following:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]

2, In your LocalSettings.php file change

$wgArticlePath = "$wgScript?title=$1";

to

$wgArticlePath = "/$1";

So it will be:

$wgScriptPath = "";
$wgScript = “$wgScriptPath/index.php”;
$wgArticlePath = “/$1″;

3, Restart apache:

apachectl restart

Popularity: 2%

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word