Question

I have just switched from using Apache to Lighttpd for a server I use to deliver dokuwiki driven help documentation. One of the things I had done with the old Apache installation was to use mirrored copy of the entire Wiki to deliver individual pages shorn of headers & side bars. This was done with the help of an Apache rewrite rule that appended do=export_xhtml to each incoming request.

RewriteEngine On
RewriteBase /dw2/

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(doku\.php/[^/]+)/?$ $1?do=export_xhtml [L,NC,QSA,R,NE]

I am no export when it comes to Apache but I usually get by. However, with Lighttpd I am a real newbie and I am having a tough time understanding how I should use its mod_rewrite capabilties. Pretty much the only thing I have accomplished thus far is to stall the server altogether. Here is my best effort

url.rewrite-once =  (
"^/dw2/([^\?]+)(\?(.*))?" => "/dw2/doku.php/$1?do=export_xhtml" 
)

I suspect that once you get the hang of it this is not a terribly difficult rule to convert to Lighty speak. I'd be much obliged to anyone who might be able to help with the conversion.

Était-ce utile?

La solution

After some trial and error... here is the answer for anyone running into this thread

url.rewrite-once = (
"^/dw2/doku.php/(.+)?" => "/dw2/doku.php/$1?do=export_xhtml" 
)

I am not 100% sure that this is completely correct but it appears to deliver the desired result - appending do=export_xhtml to the supplied url.

Autres conseils

$HTTP["querystring"] == "" {
    url.redirect = ( 
       "^/(dw2/doku\.php/[^/]+)/?$" => "http://domain.com/$1?do=export_xhtml"
    )
}

http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModRedirect

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top