Skip to:

bbPress AND Lighttpd URL rewrite rules

  • risoknop


    Hello, I have installed bbPress at one of my websites (in a subdirectory called “forums” – i.e. bbPress is installed at

    I’m trying to set up Lighttpd URL rewrite rules now in order to achieve SEO friendly permalinks.

    I have tried to google a little bit but the only thing I have found is this:

    "^/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"

    Could anybody tell me how to edit it taking into consideration the subfolder where the bbPress is installed?

    My current Lighttpd rewrite rules in config file are bellow:

    url.rewrite-once = (
    "^/(wp-.+).*/?" => "$0",
    "^/images/.*/?" => "$0",
    "^/forums/.*/?" => "$0",
    "^/temp/.*/?" => "$0",
    "^/(sitemap.xml)" => "$0",
    "^/(xmlrpc.php)" => "$0",
    "^/keyword/([A-Za-z_0-9-]+)/?$" => "/index.php?keyword=$1",
    "^/.*?(?.*)?$" => "/index.php$1"

Viewing 8 replies - 1 through 8 (of 8 total)
  • This one actually works. bbpress in /forums/

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

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

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

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

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

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

    “^/forums/tags/?$” => “/forums/tags.php”,

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

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

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

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

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

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

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

    “^/forums/rss/?$” => “/forums/rss.php”,

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

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

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

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

    I found other issues with this setup, particularly in passing more than one parameter via get. I went back to ?forum_id=1 type urls.



    There was a lighttpd “pro” on the irc channel last week named “rockerdan”

    There are also several threads around here about it:

    The problem with these solutions is that none of them work with more than one _GET parameter. Particularly with the QUOTE extension. Also, it wasn’t over clear how a larger forum would handle duplicate subject topics.

    Lighttpd “pro” – thanks but im not, hehe… Anyways it was me on irc the other day, I have bbPress running now, and have made a few changes to the the rewrite rules, I found exactly some errors regarding some urls needing more parameters…

    This is how it looks now:

    I havent been through it all but at least some it works :) (Note this also contains some of the custom rewriting im doing for this install)

    I am going to talk to the regex gurus at work tomorrow and see if some sushi is motivation enough for them. There needs to be a complete conversion from path to normal get parameters.



    Had to add an extra rule to make this work for continuation pages of the front page:

    “^/page/([0-9]+)/?$” => “/?page=$1”,

    There appears to be an issue still, within BBpress 1.02 this time: when on a continuation page, the link for “Page 1” does not include a “1” but the number of the current page – so the link does nothing and does not return to the home page.

    None of this works for me

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