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: url.rewrite-if-not-file = (     "^/wiki/(mw-)?config/?" => "$0",     "^/wiki/(.*)" => "/w/index.php?title=$1"  )
 * 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):

After restarting lighttpd it should work.
 * 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/(images|skins)/(.*)" => "$0",         "^/wiki/(mw-)?config/?(.*)" => "$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)

Lighttpd redirect and 404 handling (method #3)
$HTTP["host"] == "www.yoursite.tld" { $HTTP["url"] =~ "^/wiki/" { server.error-handler-404 = "/w/index.php" } }
 * in lighttpd.conf:

$wgScriptPath = "/w"; $wgArticlePath = "/wiki/$1"; $wgUsePathInfo = true;
 * in LocalSettings.php: