Skip to:
Content
Pages
Categories
Search
Top
Bottom

Rewriting?


  • haagendazs1
    Member

    @haagendazs1

    Hi everyone,

    Currently my forum is located in something like:

    example.com/dir/forum/

    But I want to rewrite it to be like this:

    example.com/forum/

    Since WordPress can do that, I was hoping bbPress can too, but I’m not sure how. Is there some setting I can change?

    Also secondary to that is that if there is no setting for such an option, can I just move the “forum” directory out of “dir” and into the root, and change the “bbPress address” to force it to physically be like “example.com/forum/” or would that screw things up?

    Thanks a lot everyone :)

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

  • haagendazs1
    Member

    @haagendazs1

    I’m not sure if people don’t know how to do it, or if it’s not possible, or if I’m just not explaining it clearly enough… So I’ll try again:

    Right now, physically, the folders are arranged like so:

    root.com/folder/bbpress

    The address:

    root.com/folder/bbpress

    also works and goes to the forum just fine.

    However, I want to keep the physical folders arranged that way, and make the address:

    root.com/bbpress

    WordPress itself has the exact same option under “Settings” by changing “Blog address (URL)” to whatever.

    Any help would be appreciated!


    chrishajer
    Participant

    @chrishajer


    haagendazs1
    Member

    @haagendazs1

    Hi chrishajer,

    example.com has stuff like htaccess, index.php, php.ini, robots.txt

    example.com/folder/ is the WP install that’s integrated with the forum

    and example.com/folder/bbpress/ is the aforementioned forum

    :)


    haagendazs1
    Member

    @haagendazs1

    Just wondering if anyone has the solution…


    haagendazs1
    Member

    @haagendazs1

    I’ve been trying to get this but I don’t really know what would allow this as I’m relatively new to websites, and I don’t know if this is even possible. Does anyone who knows what I’m talking about above know if this is possible for bbPress right now?

    Hey I’m been trying to get this to work also. And have posted to some other similar threads here, but there haven’t gotta a solution working.

    Here’s what I’ve learned.

    1. From what I gathered, the problem is with how bbPress redirects its pages. Even if you have the proper mod_rewrite rules, bbPress will automatically redirect the rewritten URL to the full URL that it thinks the page is supposed to have. This basically makes custom mod_rewrite useless.

    2. You can prevent bbPress from redirecting by fooling bbPress into thinking it should have a different URL than its supposed to. You can do this by modifying the get_forum_link, get_topic_link, get_user_profile link, etc. functions in the template-functions.php file. The idea is to use pattern matching to strip out the base directory from the URL.

    function get_user_profile_link( $id = 0, $page = 1 ) {
    $user = bb_get_user( bb_get_user_id( $id ) );
    $rewrite = bb_get_option( 'mod_rewrite' );
    if ( $rewrite ) {
    if ( $rewrite === 'slugs' ) {
    $column = 'user_nicename';
    } else {
    $column = 'ID';
    }
    $r = bb_get_option('uri') . "profile/" . $user->$column . ( 1 < $page ? "/page/$page" : '' );
    } else {
    $r = bb_get_option('uri') . "profile.php?id=$user->ID" . ( 1 < $page ? "&page=$page" : '' );
    }

    $r = str_replace('forums/profile/' . $user->$column , "profile/" . $user->$column, $r);
    return apply_filters( 'get_user_profile_link', $r, $user->ID );
    }

    3. If you strip out the base directory from the URL however, it makes bbPress think you’re no longer logged in, and you can’t log in. I still can’t figure out a fix yet.

    Seems like a lot of people are having issues with mod_rewrite in bbPress. Hopefully the next update will resolve some of these issues.


    haagendazs1
    Member

    @haagendazs1

    mrhoratio,

    Thanks a lot for the input. Sucks that it isn’t working out for a lot of people. I guess I’ll just live with it (for now?), and patiently wait for something out there. :) Thanks again

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

You must be logged in to reply to this topic.