Skip to:
Content
Pages
Categories
Search
Top
Bottom

Rewrite rules under lighttpd?


  • Jason
    Member

    @greenhome

    I am attempting to move my bbPress site over to a server running lighttpd – I’m running into problems converting over the rewrite rules.

    I have modified the lighttpd config files successfully to get WordPress, Magento, and some other apps working under lighttpd, but have not been able to find any examples for bbPress. Has anyone done this successfully?

Viewing 8 replies - 1 through 8 (of 8 total)

  • _ck_
    Participant

    @_ck_

    I’ve never seen it done but the rules are fairly straightforward (just a bunch of them).

    There must be a lighttpd support area where you can submit the existing rules and ask for help converting?

    (then be sure to share the results back here ;-)

    The rules on this page for something called “serendipity” look very similar to bbPress’s rules:

    http://edin.dk/archives/34-Serendipity-on-Lighty.html

    so you might be able to use them to get an idea?


    Jason
    Member

    @greenhome

    I got very close, playing around with converting it on my own. I took the .htaccess file that was generated on the old server and used it to create this (placed in my lighttpd config file):

    url.rewrite-once = (

    "^/forum/([^/]+)/page/([0-9]+)/?$" => "/forum.php?id=$1&page=$2",

    "^/forum/([^/]+)/?$" => "/forum.php?id=$1",

    "^/topic/([^/]+)/page/([0-9]+)/?$" => "/topic.php?id=$1&page=$2",

    "^/topic/([^/]+)/?$" => "/topic.php?id=$1",

    "^/tags/([^/]+)/page/([0-9]+)/?$" => "/tags.php?tag=$1&page=$2",

    "^/tags/([^/]+)/?$" => "/tags.php?tag=$1",

    "^/tags/?$" => "/tags.php",

    "^/profile/([^/]+)/page/([0-9]+)/?$" => "/profile.php?id=$1&page=$2",

    "^/profile/([^/]+)/([^/]+)/?$" => "/profile.php?id=$1&tab=$2",

    "^/profile/([^/]+)/([^/]+)/page/([0-9]+)/?$" => "/profile.php?id=$1&tab=$2&page=$3",

    "^/profile/([^/]+)/([^/]+)/favorites/?$" => "/profile.php?id=$1&tab=favorites",

    "^/profile/([^/]+)/?$" => "/profile.php?id=$1",

    "^/view/([^/]+)/page/([0-9]+)/?$" => "/view.php?view=$1&page=$2",

    "^/view/([^/]+)/?$" => "/view.php?view=$1",

    "^/rss/?$" => "/rss.php",

    "^/rss/forum/([^/]+)/?$" => "/rss.php?forum=$1",

    "^/rss/topic/([^/]+)/?$" => "/rss.php?topic=$1",

    "^/rss/tags/([^/]+)/?$" => "/rss.php?tag=$1",

    "^/rss/profile/([^/]+)/?$" => "/rss.php?profile=$1"

    )

    Most of the functionality works, but it still seems to be breaking on some minor things (like adding a topic to your favorites while logged in).


    Sam Bauers
    Participant

    @sambauers

    > but it still seems to be breaking on some minor things (like adding a topic to your favorites while logged in)

    Actually, that’s bbPress that’s broken, not your rules. Fixed in the next release :)


    Jason
    Member

    @greenhome

    Ah, thanks :) I hadn’t bothered to go back and see if those minor things were working correctly on the old server.

    I tried greenhome’s solution and it almost worked. Thanks! :-)

    However I got some minor errors, especially with links like http://domain.tld/forums/topic/test?replies=3#post-17 or http://domain.tld/forums/profile/username/favorites?fav=0&topic_id=1&_wpnonce=10a4ad44b8

    Here is a workaround :

    In /etc/lighttpd/bbpress-rewrite.conf, I have :

    url.rewrite-once += (

    # /forum/FORUM-NAME

    "^" + bbpressdir + "forum/([^/]+)/page/([0-9]+)/?$" => bbpressdir + "forum.php?id=$1&page=$2",

    "^" + bbpressdir + "forum/([^/]+)/?$" => bbpressdir + "forum.php?id=$1",

    # /topic/TOPIC-NAME

    "^" + bbpressdir + "topic/([^/?]+)(?(.*))?$" => bbpressdir + "topic.php?id=$1&$3",

    "^" + bbpressdir + "topic/([^/]+)/page/([0-9]+)(?(.*))?/?$" => bbpressdir + "topic.php?id=$1&page=$2&$4",

    # /tags/TAG-NAME

    "^" + bbpressdir + "tags/([^/]+)/page/([0-9]+)/?$" => bbpressdir + "tags.php?tag=$1&page=$2",

    "^" + bbpressdir + "tags/([^/]+)/?$" => bbpressdir + "tags.php?tag=$1",

    "^" + bbpressdir + "tags/?$" => bbpressdir + "tags.php",

    # /profile/PROFILE-NAME

    "^" + bbpressdir + "profile/([^/]+)/([^/]+)/page/([0-9]+)/?$" => bbpressdir + "profile.php?id=$1&tab=$2&page=$3",

    "^" + bbpressdir + "profile/([^/]+)/page/([0-9]+)/?$" => bbpressdir + "profile.php?id=$1&page=$2",

    "^" + bbpressdir + "profile/([^/]+)/([^/?]+)(?(.*))?/?$" => bbpressdir + "profile.php?id=$1&tab=$2&$4",

    #"^" + bbpressdir + "profile/([^/]+)/([^/]+)/?$" => bbpressdir + "profile.php?id=$1&tab=$2",

    "^" + bbpressdir + "profile/([^/?]+)(?(.*))?$" => bbpressdir + "profile.php?id=$1&$3",

    # /view/VIEW-NAME

    "^" + bbpressdir + "view/([^/]+)/page/([0-9]+)/?$" => bbpressdir + "view.php?view=$1&page=$2",

    "^" + bbpressdir + "view/([^/]+)/?$" => bbpressdir + "view.php?view=$1",

    "^" + bbpressdir + "rss/?$" => bbpressdir + "rss.php",

    # /rss/FEED-NAME

    "^" + bbpressdir + "rss/forum/([^/]+)/?$" => bbpressdir + "rss.php?forum=$1",

    "^" + bbpressdir + "rss/topic/([^/]+)/?$" => bbpressdir + "rss.php?topic=$1",

    "^" + bbpressdir + "rss/tags/([^/]+)/?$" => bbpressdir + "rss.php?tag=$1",

    "^" + bbpressdir + "rss/profile/([^/]+)/?$" => bbpressdir + "rss.php?profile=$1"

    )

    Finally, I just add this configuration for each vhost using bbpress :

    $HTTP["host"] =~ "domain.tld" {

    var.bbpressdir = "/forums/"

    include "bbpress-rewrite.conf"

    }

    Hope this helps!

    Any updates on this #

    # shoggy ?

    I have something simlar for my wordpress but this one you aded here does not work for bbpress

    do I need to add more rules?


    igre za cure
    Member

    @igre-za-cure

    work good for me.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar