You are here:Home»KB»PC»Windows Family»Windows XP»Making Clean/Short URLs in MediaWiki
Sunday, 16 November 2008 14:44

Making Clean/Short URLs in MediaWiki

Written by

Given that Meta does a poor job making elegant URLs (several things, like ampersands and periods will no longer work in titles), here’s the method I’m using:

In .htaccess, add the following:

RewriteEngine on
RewriteRule ^[^:]*\.(php|src|jpg|png|gif|css|js|inc|swf|pl|ico|html|shtml|zip|mp3)$ - [L,NC]
RewriteRule ^index.php?title - [L]
RewriteRule ^(.*)\&(.*)$ $1\%26$2
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]

In the listing of various extensions, you’ll want to put up whatever extension of file you plan on using on the site: for Retro, we also have a lot of hacking-specific extensions like bin, gen, smd, etc.

Then, open up LocalSettings.php, and use the following:

$wgScriptPath = “”;
$wgScript = “$wgScriptPath/index.php”;
$wgRedirectScript = “$wgScriptPath/redirect.php”;

$wgArticlePath = “/$1″;

From there, you should be set!

Article 2

This is a link to the official mediawiki short URL page.

http://www.mediawiki.org/wiki/Manual:Short_url

Read 1302 times