Search code examples
apache.htaccessmod-rewritelighttpd

Lighttpd rewrite - multiple variables


I'm moving from Apache to Lighttpd and need to setup similar rewrite rules.

How would I go about having multiple folders creating URL variables? This works well in Apache:

RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?x=$1 [L]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?x=$1&y=$2 [L]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?x=$1&y=$2&z=$3 [L]

Thanks,

Mike


Solution

  • Try:

    url.rewrite-once = (
       "^/([A-Za-z0-9-]+)/?$" => "/index.php?x=$1",
       "^/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$" => "/index.php?x=$1&y=$2",
       "^/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$" => "/index.php?x=$1&y=$2&z=$3"
    )