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.
How to host multiple forums with one installation?
Moderator: General Moderators
-
Starcraftmazter
- Forum Commoner
- Posts: 45
- Joined: Mon Apr 24, 2006 11:36 pm
-
Starcraftmazter
- Forum Commoner
- Posts: 45
- Joined: Mon Apr 24, 2006 11:36 pm
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
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
-
Starcraftmazter
- Forum Commoner
- Posts: 45
- Joined: Mon Apr 24, 2006 11:36 pm
Let's say you have DOC_ROOT/boards/phpBB2
Now you can place a .htaccess in DOC_ROOT/boards with the contents
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.
Now you can place a .htaccess in DOC_ROOT/boards with the contents
Code: Select all
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !^phpBB2/
RewriteRule ^[^/]+/(.*)$ phpBB2/$1The 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.
-
Starcraftmazter
- Forum Commoner
- Posts: 45
- Joined: Mon Apr 24, 2006 11:36 pm
I have just tested this script, and it works!!!!
http://starcraftmazter.net/test/Insert_ ... /index.php
Thanks Volka, good job mate
http://starcraftmazter.net/test/Insert_ ... /index.php
Thanks Volka, good job mate