Manual:Short URL/wiki/Page title -- Lighttpd rewrite--root access

Lighttpd rewrite #1
Example configuration:
 * wiki is installed in /w/ directory in http root dir.
 * you want to avoid index.php
 * you want to access articles as /wiki/Article

Please note the installation path (/w/ above) and the virtual path to access articles (/wiki/ above) must be different, or the styles won't load at all (and other issues, with extensions for instance), as explained in the main article Then there are two things needed to change in two files:
 * lighttpd.conf
 * enable mod_rewrite in server modules
 * add below code as rewriting (first line should use +=, not =, if you have other rewrite-once rules, or append these to the ones you have):

url.rewrite-if-not-file = (    # Rewrite the article path     "^/wiki/([^?]*)(?:\?(.*))?" => "/w/index.php?title=$1&$2",     "^/wiki/?$" => "/w/index.php", ) After restarting lighttpd it should work. The code is not fully rewriting the code cause pages lik Linking to this page or Printable version etc are linked to /w/index.php?... anyway. So this code requires tweaking by more experienced users.
 * now edit /w/LocalSettings.php

Lighttpd rewrite #2
'''WARNING: This rewrite is flawed because its real and virtual paths overlap. You will not be able to access api.php without modifications to the rewrite rules, and you will not be able to create a page called index.php'''

Here a working setup for pretty URLs like http://example.com/wiki/Main_page


 * MW root is in doc root subfolder 'wiki/'
 * lighttpd-1.4.13
 * mediawiki-1.11.0


 * In LocalSettings.php:

$wgScriptPath = "/wiki";    // where the wiki root is under the doc root $wgArticlePath = "/wiki/$1"; // how rel.urls are prefixed on the page $wgUsePathInfo = false;     // if MW determines the page by URL path and not only by URL query args


 * lighttpd.conf:

url.rewrite-once = (        "^/wiki/[sS]kins.*$"  =>      "$0",         "^/wiki/([^\?]*)$"    =>      "/wiki/index.php?title=$1", )


 * First line returns subrequest urls to css files etc. unchanged.
 * Second line checks for URLs without "?" (assumes it's a simple URL like above)


 * URLs which pass both are left unchanged, ie. http://florian-konnertz.de/wiki/index.php?title=Spezial:Abmelden&returnto=Hauptseite

Not completely sure if i didnt miss a possible case... hope this helps groovehunter 05:37, 28 May 2008 (UTC)