Project

General

Profile

HowToRewriteForDokuWiki » History » Revision 3

Revision 2 (Terminar, 2007-12-05 14:03) → Revision 3/4 (Terminar, 2012-08-11 10:42)

h2. DokuWiki CleanURLs with Lighttpd 


 Here is a version from darix in irc.freenode.net #lighttpd which fixed many errors such as optional trailing slash etc. 



 <pre> 

 #!lighttpdconf 
 $HTTP["host"] =~ "some.otherhost.com" { 
     server.document-root = "/var/www/htdocs" 
     # DO NOT FORGET THE TRAILING SLASH HERE 
     # var.wiki_base = "/wiki/" 
     # var.wiki_base = "/" 
     var.wiki_base = "/" 
     # 
     $HTTP["url"] =~ "^" + var.wiki_base { 
       #RewriteRule ^$            doku.php    [L] 
       #RewriteRule ^index.php$ doku.php 
       index-file.names = ("doku.php") 
     } 
     url.rewrite = ( 
       # 
       "^" + var.wiki_base + "lib/.*$" => "$0", 
       #RewriteRule ^_media/(.*)                lib/exe/fetch.php?media=$1    [QSA,L] 
       #RewriteRule ^_detail/(.*)               lib/exe/detail.php?media=$1    [QSA,L] 
       #RewriteRule ^_export/([^/]+)/(.*)       doku.php?do=export_$1&id=$2    [QSA,L] 
       #RewriteRule (.*)                        doku.php?id=$1    [QSA,L] 
       #RewriteRule ^index.php$                 doku.php 
       "^" + var.wiki_base + "_media/(.*)"            => var.wiki_base + "lib/exe/fetch.php?media=$1",    #    [QSA,L] 
       "^" + var.wiki_base + "_detail/(.*)"           => var.wiki_base + "lib/exe/detail.php?media=$1", #    [QSA,L] 
       "^" + var.wiki_base + "_detail/(.*)\?id(.*)"           => var.wiki_base + "lib/exe/detail.php?media=$1&id=$2", #    [QSA,L] 
       "^" + var.wiki_base + "_export/([^/]+)/(.*)" => var.wiki_base + "doku.php?do=export_$1&id=$2", #    [QSA,L] 
       "^" + var.wiki_base + "doku.php.*"             => "$0", 
       "^" + var.wiki_base + "index.php/(.*)"             => var.wiki_base + "doku.php?id=$1", 
       "^" + var.wiki_base + "index.php\?display=(.*)"             => var.wiki_base + "doku.php?id=$1", 
       "^" + var.wiki_base + "index.php.*"             => "$0", 
       "^" + var.wiki_base + "feed.php.*"             => "$0", 
       "^" + var.wiki_base + "sitemap.xml.gz"             => "$0", 
       "^" + var.wiki_base + "(.*)\?(.*)"             => var.wiki_base + "doku.php?id=$1&$2",             #    [QSA,L] 
       "^" + var.wiki_base + "(.*)"                   => var.wiki_base + "doku.php?id=$1",                #    [QSA,L] 
     ) 
 } 

 </pre> 



 h2. DokuWiki Config 


 To the local.php or local.protected.php, add 


 <pre> 

 $conf['userewrite'] = '1'; 
 </pre> 


 Some things are maybe missing (i had some problems with the detail.php) but the basic setup works (for me).