Page 1 of 1
How to host multiple forums with one installation?
Posted: Fri Nov 24, 2006 10:49 pm
by Starcraftmazter
Say you have 5 users with 5 separate databases, using the same phpbb install.
I know that can be done, but how?
I would assume, all you have to do is serve a slightly different config.php file based on some factor - eg. subdomain.
Can that be done using .htaccess, or how is it done?
Thanks.
Posted: Fri Nov 24, 2006 11:25 pm
by volka
Depends on the forum software.
Posted: Fri Nov 24, 2006 11:26 pm
by Starcraftmazter
I believe I said phpbb.
Posted: Fri Nov 24, 2006 11:40 pm
by volka
Yes, sorry, you did.
You can use .htaccess and
mod_rewrite to let apache execute the same scripts for different request paths.
Depending on the "real" path (stored somewhere in _SERVER, just take a look at print_r($_SERVER); ) you can e.g. inlucde different files in config.php
Posted: Fri Nov 24, 2006 11:58 pm
by Starcraftmazter
Could you be more specific? I don't know much about .htaccess/mod_rewrite
Posted: Sat Nov 25, 2006 12:29 am
by volka
Let's say you have
DOC_ROOT/boards/phpBB2
Now you can place a .htaccess in
DOC_ROOT/boards with the contents
Code: Select all
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !^phpBB2/
RewriteRule ^[^/]+/(.*)$ phpBB2/$1
For the request
http://yourserver/board/userA/index.php %{SCRIPT_FILENAME} will contain userA/index.php (not boards/userA/index.php since the rule already is "located" in boards/)
The string does not start with phpBB2/ therefore the RewriteCond is matched and the RewriteRule is executed.
The RewriteRule cuts the first directory from the path and prepends phpBB2/ instead, userA/index.php -> phpBB2/index.php
The "real" request path should be available via $_SERVER['REQUEST_URI'] in config.php.
I've never done such a thing (except for a short test right now) and I'm not very familiar with phpBB. If you want to be on the safe side ask at
http://www.phpbb.com/ . May even be there already is a ready-to-use mod for this.
Posted: Sat Nov 25, 2006 12:32 am
by Starcraftmazter
Alright, thanks!
Posted: Sat Nov 25, 2006 5:48 am
by Starcraftmazter
I have just tested this script, and it works!!!!
http://starcraftmazter.net/test/Insert_ ... /index.php
Thanks Volka, good job mate
