Drupal on Lighttpd

In the lighttpd config:

?View Code LIGHTTPD
1
2
3
4
5
6
7
8
9
$HTTP["host"] == "host" {
  server.document-root = "/home/exitable/public_html/"
  url.rewrite-final = (
    "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
    "^/([^.?]*)$" => "/index.php?q=$1",
    "^/([^.?]*\.html)$" => "/index.php?q=$1"
  )
  server.error-handler-404 = "/index.php"
}

and then add to the /sites/default/settings.php file some code to catch 404 pages:

1
2
3
4
5
6
7
8
9
10
11
12
/* modification for lighttpd and imagecache*/
$_lighty_url = urldecode($base_url . $_SERVER['REQUEST_URI']);
$_lighty_url = @parse_url($_lighty_url);
 
if ($_lighty_url['path'] != '/index.php' && $_lighty_url['path'] != '/update.php' && $_lighty_url['path'] != '/') {
	$_SERVER['QUERY_STRING'] = $_lighty_url['query'];
	parse_str($_lighty_url['query'], $_lighty_query);
	foreach ($_lighty_query as $key => $val){
		$_GET[$key] = $_REQUEST[$key] = $val;
	}
	$_GET['q'] = $_REQUEST['q'] = substr($_lighty_url['path'], 1);
}