Hi there I am trying to 'port' some rewrite rules from Apache over to Lighty; however I'm running into problems. Knowing me it's probably something blatantly obvious; but I get a 404 whenever I try to access any of the URLs in the rewrite section. lighttpd.conf is attached, rewrite section follows: url.rewrite = ( "^search" => "/index.php?a=search", "^media/([0-9]*)" => "/index.php?a=media&v=$1", "^help" => "/index.php?a=help", "^register" => "/index.php?a=register", "^doRegister" => "/index.php?a=doregister" ) Thanks in advance if anyone can help. -Chris
on 08.05.2008 11:05
on 08.05.2008 11:06
Chris N wrote: > Hi there > > I am trying to 'port' some rewrite rules from Apache over to Lighty; > however I'm running into problems. Knowing me it's probably something > blatantly obvious; but I get a 404 whenever I try to access any of the > URLs in the rewrite section. > > lighttpd.conf is attached, rewrite section follows: > > url.rewrite = ( > "^search" => "/index.php?a=search", > "^media/([0-9]*)" => "/index.php?a=media&v=$1", > "^help" => "/index.php?a=help", > "^register" => "/index.php?a=register", > "^doRegister" => "/index.php?a=doregister" > ) > > Thanks in advance if anyone can help. > > -Chris Oops, forgot my configuration, running - Debian Etch - box:/home/cmn# lighttpd -v lighttpd-1.4.19 - a light and fast webserver Build-Date: May 2 2008 11:01:43 (from source tarball)
on 08.05.2008 12:25
Chris N wrote: > Chris N wrote: >> Hi there >> >> I am trying to 'port' some rewrite rules from Apache over to Lighty; >> however I'm running into problems. Knowing me it's probably something >> blatantly obvious; but I get a 404 whenever I try to access any of the >> URLs in the rewrite section. >> >> lighttpd.conf is attached, rewrite section follows: >> >> url.rewrite = ( >> "^search" => "/index.php?a=search", >> "^media/([0-9]*)" => "/index.php?a=media&v=$1", >> "^help" => "/index.php?a=help", >> "^register" => "/index.php?a=register", >> "^doRegister" => "/index.php?a=doregister" >> ) >> >> Thanks in advance if anyone can help. >> >> -Chris > > Oops, forgot my configuration, running > > - Debian Etch > - box:/home/cmn# lighttpd -v > lighttpd-1.4.19 - a light and fast webserver > Build-Date: May 2 2008 11:01:43 (from source tarball) Nevermind, figured it out -- unlike Apache which matches everything after the first '/' after the hostname (or RewriteBase), Lighttpd matches everything after the hostname including the '/'. So the below is correct: url.rewrite = ( "^/search" => "/index.php?a=search", "^/media/([0-9]*)" => "/index.php?a=media&v=$1", "^/help" => "/index.php?a=help", "^/register" => "/index.php?a=register", "^/doRegister" => "/index.php?a=doregister" ) Hope this saves someone else the trouble. -C

