Lighttpd(and other servers) with mod_rewrite
|
Jun 30, 2008 22:02
3 posts
|
Hi everyone, This is my method to get mod_rewrite working on most servers(even Apache if you want to use mod_rewrite). I have tested this on Lighttpd and everything seems to be working right. The basic idea is to PHP+error page to get everything working. So, make a file in the main Frog CMS folder called error-handler.php and put the following code in it. <?php //assumes that the Frog isn't in a subfolder //to fix that explode($_SERVER['SCRIPT_FILENAME']) with array_diff //this doesn't do that because it would limit slugs(couldn't be equal //to any parent folder of frog) if(isset($_SERVER['REQUEST_URI'])){ $parts = explode("/",$_SERVER['REQUEST_URI']); if(count($parts)){ if($parts[0] == ""){ array_shift($parts); } $_SERVER['QUERY_STRING'] = implode("/",$parts); } else{ $_SERVER['QUERY_STRING'] = ""; } if(isset($parts[0]) && $parts[0] == "admin"){ chdir("admin"); array_shift($parts); $_SERVER['QUERY_STRING'] = implode("/",$parts); } } require_once("index.php"); ?> After that, setup your database to put all 404 errors to error-handler.php. In lighttpd this would look like server.error-handler-404 = "/error-handler.php" |
|
Jun 30, 2008 22:05
3 posts
|
Wow, forum screwed with the code...let me try that again, here is the code again
|