MediaWiki and clean URLs
Posted by: nphyre
Posted on: 2005-08-27 12:29:00
You can have clean URLs with the one-click install of Mediawiki. Here's how.
Install the wiki into www.yourdomain.com/w and NOT into www.yourdomain.com/wiki, using the Dreamhost one-click install menu.
Modify the following in LocalSettings.php after you have set it up:
$wgArticlePath = "/wiki/$1";
In the ROOT directory of www.yourdomain.com, place the following .htaccess file:
RewriteEngine on
# uncomment this rule if you want Apache to redirect from www.mysite.com/ to www.mysite.com/wiki/Main_Page
# RewriteRule ^/$ /wiki/Main_Page [R]
# do the rewrite
RewriteRule ^wiki/?(.*)$ /w/index.php?title=$1 [L,QSA]
Note that I haven't tested the redirect RewriteRule, as I use an index.php in my root directory that sends a Location header, so I can more easily take the site down for maintenance.