Search

Hey folks,

I have always had a big struggle with getting Symphony to work on LightTPD (Lighty), because there's no suitable way to migrate Apache's rewrite rules to Lighty.

So I played with another approch a bit.

1) Deleting the .htaccess files 2) Adding the following code to both /index.php and /symphony/index.php (before the inclusion of the config file!) $GET['page'] = substr($SERVER['REQUESTURI'], strlen(dirname($SERVER['PHP_SELF']))); 3) Setting the ErrorHandler to /index.php (respectively /symphony/index.php)

That works perfectly for me.

This approach would be a good practice, as it eleminates Symphony's fixation on Apache. Besides that, it saves performance because there's no need for alle the rewriting at each request.

Hi lgierth, I too use Lighttpd and as such, have the same dilemma. Here is the ruleset I have come up with based on this post and some munging of my own. These rules are for Symphony 2 (note the colon notation for params) and LightTPD. (please note, this was a total of 10 minutes work. I am sure they can be optimized to perform better)

url.rewrite-once = (
            "^/image\/3\/([0-9]+)\/([0-9]+)\/([1-9])\/([a-fA-f0-9]{3,6})(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$" =>  "/symphony/image.php?param=3:$1:$2:$3:$4:$6:$7.$8",
            "^/image\/2\/([0-9]+)\/([0-9]+)\/([1-9])(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$" => "/symphony/image.php?param=2:$1:$2:$3:0:$5:$6.$7",
            "^/image\/1\/([0-9]+)\/([0-9]+)(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$" => "/symphony/image.php?param=1:$1:$2:0:0:$4:$5.$6",
            "^/image(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$" => "/symphony/image.php?param=0:0:0:0:0:$2:$3.$4",
            "^/([a-zA-Z0-9-_/]+)?do=(ajax)&ajax=(comments|contact)&id=([0-9]+)$" => "index.php?do=$2&ajax=$3&id=$4",
            "^/(?!index.php|campfire|manifest|symphony|workspace|login(?# You can add more))([a-zA-Z0-9-_/]+)$" => "index.php?page=$1",
            "^/workspace/(.*)$"  =>  "/workspace/$1",
            "^/symphony/(css|images|assets|js)/(.*)$"  =>  "/symphony/$1/$2",
            "^/symphony/(.*)$"  =>  "/symphony/index.php?page=$1",
            "^/install.php$"  =>  "/install.php",
            "^/$"  =>  "/index.php?page=$1",
            "^/(.*)\?(.*)$"  =>  "/index.php?page=$1&$2",
            "^/\?(.*)$"  =>  "/index.php?page=articles/?$2",
            "^/(.*)$"  =>  "/index.php?page=$1"
    )

HTH

Hi byr0n,

I started using your rewrite rules recently and found a bug with the ?filter= GET variable in r4. I'll post a fix for this when I'm back home.

Best regards, Lars

Cool Lars, nice to see someone else working with Lighty :) It would be nice if we can get a complete working set published. I still have issues with these rules too and will, when time permits, get something formally done that works with S2 final. With Lighty, the winner I think will be something utilizing mod_magnet as it will provide the functionality a little more robustly...

To fix the issues I mentioned I added this line:

"^/symphony/(.*)\?(.*)$"  =>  "/symphony/index.php?page=$1&$2",

I also added the following line, because I got Symphony's 404 page when calling the backend without the trailing slash (e.g. http://host/symphony).

"^/symphony$"  =>  "/symphony/index.php?page=",

BTW, the ruleset works perfectly with 1.7, too :)

mod_magnet indeed looks interesting, but I think it might be a bit oversized (I only took a quick look at the wiki page). Would that be easy to realize and would it be as fast as the rewrite rules?

Well, after a while doing "work" work I can finally get back to playing w/S2... I found this which talks about speed (compared to mod_rewrite) with just a 404 handler but overall, lua is pretty fast by itself. The big drawback I saw was that complex operations are blocking, so that will stall other requests... gonna go add your changes to my conf and see where it takes me :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details