Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress in a subdomain, on a WPMU install?


  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Here’s a question for the bbPress guru side of this. Is it possible to have forums.domain.com on a WPMU install, and have that domain forward to a bbPress installation? My guess is it would take some creative hacking of .htaccess, but I’ll be honest to say I don’t know how I’d do it.

    Thoughts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Totally possible, we do it on WordPress.com

    Easiest approach is to setup a new virtual host for that subdomain before your WPMU virtualhost in Apache. You can then catch it before it goes to the WPMU install which usually catches all subdomains.

    You can also do it from the same virtualhost for a thrill. That does require some .htaccess hackery. This is how WordPress.com is done.

    NB: these rules are for bbPress 0.9 and are supposed to catch all our localised forum domains – it also may not work for everyone. The important part of the rules to note is the skip (S=30) rule at the start.

    # Skip forum rules if not in *.forums.wordpress.com
    RewriteCond %{HTTP_HOST} !^(.+.)*forums.wordpress.com
    RewriteRule .* -

    # Forum rules
    # If you change the total number of rules, the skip rule above must be updated too
    RewriteRule ^/?$ /bbpress/ [L]
    RewriteRule ^bb-admin$ /bb-admin/ [R,L]
    RewriteRule ^bb-admin/(.*)$ /bbpress/bb-admin/$1 [L,QSA]
    RewriteRule ^bb-images/(.*)$ /bbpress/bb-images/$1 [L,QSA]
    RewriteRule ^bb-includes/js/(.*)$ /bbpress/bb-includes/js/$1 [L,QSA]
    RewriteRule ^([^/]+).php(.*)$ /bbpress/$1.php$2 [L,QSA]
    RewriteRule ^forum/([^/]+)/page/([0-9]+)/?$ /bbpress/forum.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^forum/([^/]+)/?$ /bbpress/forum.php?id=$1 [L,QSA]
    RewriteRule ^forum/?$ /bbpress/ [R,L]
    RewriteRule ^topic/([^/]+)/page/([0-9]+)/?$ /bbpress/topic.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^topic/([^/]+)/?$ /bbpress/topic.php?id=$1 [L,QSA]
    RewriteRule ^topic/?$ /bbpress/ [R,L]
    RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ /bbpress/tags.php?tag=$1&page=$2 [L,QSA]
    RewriteRule ^tags/([^/]+)/?$ /bbpress/tags.php?tag=$1 [L,QSA]
    RewriteRule ^tags/?$ /bbpress/tags.php [L,QSA]
    RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ /bbpress/profile.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^profile/([^/]+)/([^/]+)/?$ /bbpress/profile.php?id=$1&tab=$2 [L,QSA]
    RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ /bbpress/profile.php?id=$1&tab=$2&page=$3 [L,QSA]
    RewriteRule ^profile/([^/]+)/?$ /bbpress/profile.php?id=$1 [L,QSA]
    RewriteRule ^profile/?$ /bbpress/profile.php [L,QSA]
    RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ /bbpress/view.php?view=$1&page=$2 [L,QSA]
    RewriteRule ^view/([^/]+)/?$ /bbpress/view.php?view=$1 [L,QSA]
    RewriteRule ^rss/?$ /bbpress/rss.php [L,QSA]
    RewriteRule ^rss/topics/?$ /bbpress/rss.php?topics=1 [L,QSA]
    RewriteRule ^rss/forum/([^/]+)/?$ /bbpress/rss.php?forum=$1 [L,QSA]
    RewriteRule ^rss/forum/([^/]+)/topics/?$ /bbpress/rss.php?forum=$1&topics=1 [L,QSA]
    RewriteRule ^rss/topic/([^/]+)/?$ /bbpress/rss.php?topic=$1 [L,QSA]
    RewriteRule ^rss/tags/([^/]+)/?$ /bbpress/rss.php?tag=$1 [L,QSA]
    RewriteRule ^rss/profile/([^/]+)/?$ /bbpress/rss.php?profile=$1 [L,QSA]
    RewriteRule ^rss/view/([^/]+)/?$ /bbpress/rss.php?view=$1 [L,QSA]
    # If you add more forum rules then you must update the skip rule above them as well


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Thanks Sam. I’ve yet to try this, but I will tomorrow and will let you know how it works. I suspect probably better than I could ever do on my own. :)

    My guess, is this works if bbPress is installed in a directory off the WordPress root called “/bbpress/” ?

    Does this mean that some/all of the code above goes into the WordPress .htaccess file to prevent it from taking over, or does it go in the bbPress .htaccess file?

    We have bbPress physically located a subdirectory within WordPress.com (WPMU), you can call that “bbpress”. We do it this way because we point *.wordpress.com to the same host (well not exactly, but for the point of the example let’s say we do). Anyway, because on WordPress.com all blogs are given a subdomain, we need to intercept the forum subdomains and push them to the bbPress code before WPMU executes. That’s what this .htaccess code does.

    You could do it without fewer rewrite rules if you didn’t use pretty permalinks.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Just finally got around to doing this. The .htaccess method worked awesomely.

    To clarify for anyone else reading this, you’ll want to put the above .htaccess code in your WordPress .htaccess file, because that’s where the bbPress requests will still be hitting. You can remove the .htaccess file in your bbPress directory using this method.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Thought I had it going and it was time to celebrate, but maybe not…

    The .htaccess method worked awesomely on the install, but dies for me on the forum itself. Can’t get to anything but the index.php. No styles load, and I can’t access things like the CSS files directly either.

    Suggestions? I tried removing the rewriting rules all together because I haven’t setup my permalinks yet, and still nothing there either.

    Hmmm…


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    So I was able to take hybrid bits and pieces of what you posted above, and the .htaccess for 1.0.1, and get the forums working, but still no .css and no .js, and no access to the admin panel or any directory either. Seems if I navigate to the physical URL domain.com/forums/bb-admin/ I can get in, but forums.domain.com/bb-admin/ gives an internal server error and a 500.

    Still troubleshooting.


    Mark
    Member

    @delayedinsanity

    I’ll post this here, as this is probably the closest thread I’ve found relating to what I’m trying to do.

    I’m setting up a µ site that will be using bbPress on the main blog. Since I don’t want to usurp *.domain.tld/forums/ on every blog, I set up bbPress under its own subdomain.

    Works fine using either an Apache VirtualHost or the above mod_rewrite method, right up until I try to load µ from within bbpress (there are a LOT of functions I would like to use without rewriting them, so this is absolutely necessary). Once I load wp-config in bbPress, trying to access the forums 302 redirects me back to blog. Looks like I can have my subdomain, or my integration, but I can’t have both at the same time.

    Has anybody gotten this to work?


    Mark
    Member

    @delayedinsanity

    I know it’s only been 16 hours… but this thread is falling off the front page, and I’m still trying to find an answer. Bumpity bump bump bump.


    Mark
    Member

    @delayedinsanity

    *one last bump*

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