[2.0.15] Allow multiple domain names

The cleanup is complete. This forum is now read only.
Post Reply

Rating:

Excellent!
14
58%
Very Good
4
17%
Good
3
13%
Fair
2
8%
Poor
1
4%
 
Total votes: 24

Extensions Robot
Extensions Robot
Extensions Robot
Posts: 28534
Joined: Sat Aug 16, 2003 7:36 am

[2.0.15] Allow multiple domain names

Post by Extensions Robot »

MOD Name: Allow multiple domain names
Author: HSorgYves
MOD Description: This MOD allows you to use multiple domain names and/or access paths with your phpbb board


MOD Version: 1.1.0 (Updated 05/14/05)

Download File: allow_multiple_domains_1.1.0.mod
mods overview page: View
File Size: 3887 Bytes

Security Score: 0
Last edited by Extensions Robot on Mon Apr 30, 2007 12:29 am, edited 1 time in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)
Darkmonkey
Former Team Member
Posts: 1707
Joined: Fri Oct 24, 2003 3:48 pm
Location: Where the trout streams flow and the air is nice

Post by Darkmonkey »

MOD Validated/Released

Notes:
This MOD allows you to use multiple domain names, all directing to a single board. (ie: www.mysite.com/www.yoursite.com; no need to set a domain name in the Administration Control Panel)
e2
Registered User
Posts: 2
Joined: Fri Sep 03, 2004 10:00 pm

What if your froums are in different directories?

Post by e2 »

What if your forums are in different directories?

You need to modify the "SCRIPT_PATH". I hard coded this, is there a dynamic way of doing this?

The Mod to this that would make it work on multiple domains and the forum is located in a different folder on each domain. You would need to change the 'script_path'. For now I added this and it works but it's hard coded, so if you have a dynamic solution for this that would be great. Here is what I modified.

For my first domain my forum is located in the /forum folder on my site. I added this to my common.php file for the first domain. Added below the original code.

Code: Select all

//Allow multiple domain names 
$board_config['server_name'] = ( !empty( $_SERVER ) ) ? $_SERVER['SERVER_NAME'] : $HTTP_SERVER_VARS['SERVER_NAME']; 
//End Allow multiple domain names 

//Allow multiple domains with different paths to the forums
$board_config['script_path'] = "/forum";  // I added this line
//EndAllow multiple domains with different paths to the forums
For my second domain my forum is located in the /resources/forum folder on my site. I added this to my common.php file for the second domain. Added below the original code.

Code: Select all

//Allow multiple domains names
/$board_config['server_name'] = ( !empty( $_SERVER ) ) ? $_SERVER['SERVER_NAME'] : $HTTP_SERVER_VARS['SERVER_NAME']; 
//End Allow multiple domain names 

//Allow multiple domains with different paths to the forums
$board_config['script_path'] = "/resources/forum";  // I added this line
//EndAllow multiple domains with different paths to the forums
dirtdart
Registered User
Posts: 28
Joined: Fri Jul 02, 2004 4:54 am

Post by dirtdart »

I've seen some posts on this board that allow you to use the same database for two different forums. That might be closer to what you're trying to accomplish.
stu15
Registered User
Posts: 1283
Joined: Sat Mar 15, 2003 1:46 am
Location: New Zealand
Contact:

Post by stu15 »

This will be a useful mod for the next time I have to move a large forum between hosts!

Good work Dirtdart! 8) & I am looking forward to using it in the future.
A Registered User > I maybe wrong...So please correct him :) || My Forum - Stu's phpBB Helpdesk
dirtdart
Registered User
Posts: 28
Joined: Fri Jul 02, 2004 4:54 am

Re: What if your froums are in different directories?

Post by dirtdart »

e2 wrote: What if your forums are in different directories?

You need to modify the "SCRIPT_PATH". I hard coded this, is there a dynamic way of doing this?

The Mod to this that would make it work on multiple domains and the forum is located in a different folder on each domain. You would need to change the 'script_path'. For now I added this and it works but it's hard coded, so if you have a dynamic solution for this that would be great. Here is what I modified.

For my first domain my forum is located in the /forum folder on my site. I added this to my common.php file for the first domain. Added below the original code.

Code: Select all

//Allow multiple domain names 
$board_config['server_name'] = ( !empty( $_SERVER ) ) ? $_SERVER['SERVER_NAME'] : $HTTP_SERVER_VARS['SERVER_NAME']; 
//End Allow multiple domain names 

//Allow multiple domains with different paths to the forums
$board_config['script_path'] = "/forum";  // I added this line
//EndAllow multiple domains with different paths to the forums
For my second domain my forum is located in the /resources/forum folder on my site. I added this to my common.php file for the second domain. Added below the original code.

Code: Select all

//Allow multiple domains names
/$board_config['server_name'] = ( !empty( $_SERVER ) ) ? $_SERVER['SERVER_NAME'] : $HTTP_SERVER_VARS['SERVER_NAME']; 
//End Allow multiple domain names 

//Allow multiple domains with different paths to the forums
$board_config['script_path'] = "/resources/forum";  // I added this line
//EndAllow multiple domains with different paths to the forums


You could probably use the $HTTP_SERVER_VARS['PATH_INFO'] variable to do this. You'd have to parse off everything beyond the last / because it will be the file name.
markjay
Registered User
Posts: 16
Joined: Tue Sep 14, 2004 1:07 pm

Post by markjay »

When I test it on http://127.0.0.1 Everytime I login it takes me to "Page cannot be displayed" I have to press back and refresh button to login.

If you know something please tell me!
What You See Is What You Get...
User avatar
HaraldR
Registered User
Posts: 11
Joined: Thu Jun 26, 2003 9:54 am
Location: Berlin

Post by HaraldR »

markay wrote: When I test it on http://127.0.0.1 Everytime I login it takes me to "Page cannot be displayed" I have to press back and refresh button to login.


In your databse in table phpBB__config in field script_path you have to set the correct path.

If the adresse is i.e. htt://127.0.0.1/directory/two/phpBB2/index.php , you have to set sript_path /directory/two/phpBB2/
User avatar
Snowboardalliance
Registered User
Posts: 98
Joined: Mon Nov 29, 2004 2:36 am

Post by Snowboardalliance »

How exactly does this work?? I have a few subdomains (seperate accounts) so how can I use this to share a board between them? (Do I need phpBB on both and it SHARES ONE database??)
help please
Last edited by Snowboardalliance on Tue May 17, 2005 10:29 pm, edited 1 time in total.
dirtdart
Registered User
Posts: 28
Joined: Fri Jul 02, 2004 4:54 am

Post by dirtdart »

No, it's basically just an alias system. If you have one board that goes by several names (for instance, you're migrating from one domain name to another), it allows the board to be known by both names ie: http://www.mysite.com and http://www.mynewsite.com.
jlick
Registered User
Posts: 1
Joined: Sun Jan 09, 2005 8:27 am
Location: Taipei, Taiwan R.O.C.

Post by jlick »

Is there any problem with setting $board_config['sitename'] the same way as $board_config['server_name'] is set in this mod? This allows the "site.com Forum Index" and the domain name shown at the top of the page (with standard skin) to show the different host names depending which url you access the site with. I've tried it and it seems to work OK, but I haven't done a lot of modding so not sure if this would screw up something else.
wimpel
Registered User
Posts: 1
Joined: Fri Jan 14, 2005 10:43 am

problem with virtual hosts

Post by wimpel »

I've just "installed" this mod in my 2.0.11 version and it works ok. thanks!
Still got a small question though:

I've got ONE forum running, and it is accessible from TWO domains which I've set up als <VirtualHosts> in my httpd.conf.
The first domain has "/www" as DocumentRoot
The second domain has "/www/whatever" as DocumentRoot
The index.php of the forum is located in "/www/whatever/phpBB2"

My problem is that I cannot log in from one of the two domains, because the "path" in the configuration can only contain one value. If it says "whatever/phpBB2/" it is impossible to log in from the second domain. When I set the past to "phpBB2/" it is possible to log in from the second domain, but not from the first.

Since I'm running ONE forum, I've only got ONE common.php to add stuff to ;-)

Has anyone got suggestions on how to solve this issue?
blurius
Registered User
Posts: 5
Joined: Fri Jan 21, 2005 6:53 pm

Re: [2.0.10] Allow multiple domain names

Post by blurius »

MOD Database Manager wrote: Classification: 51 Add-On's

MOD Name: Allow multiple domain names
Author: dirtdart
MOD Description: Allows you to use multiple domain names (ie: www.mysite.com, www.yoursite.com) pointing to a single board.

MOD Version: 1.0.1
Installation Level: Easy
Installation Time: ~ 1 Minute

Download File: allow_multiple_domains_1.0.1.mod
File Size: 2626 Bytes

Security Score:


Sorry, i'm a newbbie, can someone explain to me how to install this file?
Thanks :)
User avatar
otseng
Registered User
Posts: 165
Joined: Wed Feb 04, 2004 6:51 pm
Location: Atlanta, GA
Contact:

Post by otseng »

Simple mod, but it works. :)

I've modified it a little bit so that it can work with phpbb installed on my local computer:

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
# 
common.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
while ( $row = $db->sql_fetchrow($result) ) 
{ 
   $board_config[$row['config_name']] = $row['config_value']; 
} 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//Allow multiple domain names 
if (!strstr($board_config['server_name'], "localhost"))
{
	$board_config['server_name'] = ( !empty( $_SERVER ) ) ? $_SERVER['SERVER_NAME'] : $HTTP_SERVER_VARS['SERVER_NAME']; 
}
//End Allow multiple domain names 
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
Eric_H
Registered User
Posts: 149
Joined: Fri Jan 21, 2005 8:03 pm
Contact:

Re: problem with virtual hosts

Post by Eric_H »

Is there a way to make the cookie domain path act the same? As it is now, on my new board I have to log in EVERY TIME I go to the board. The old site allows me to stay logged in, but the new one makes me log in every time.

If you go to your ACP and look in the "Cookies Settings" area, you will see "Cookie domain"... that's the area that I need to be able to make "flexible" as well. Hope this makes sense.
wimpel wrote: I've just "installed" this mod in my 2.0.11 version and it works ok. thanks!
Still got a small question though:

I've got ONE forum running, and it is accessible from TWO domains which I've set up als <VirtualHosts> in my httpd.conf.
The first domain has "/www" as DocumentRoot
The second domain has "/www/whatever" as DocumentRoot
The index.php of the forum is located in "/www/whatever/phpBB2"

My problem is that I cannot log in from one of the two domains, because the "path" in the configuration can only contain one value. If it says "whatever/phpBB2/" it is impossible to log in from the second domain. When I set the past to "phpBB2/" it is possible to log in from the second domain, but not from the first.

Since I'm running ONE forum, I've only got ONE common.php to add stuff to ;-)

Has anyone got suggestions on how to solve this issue?
Post Reply

Return to “[2.0.x] MOD Database Cleanup”