Coming back to this argument, here is another implementation I have realized recently.
Requirements
- Linux server
- 1 vbulletin installation (domain1.tld)
- 2 or more domains on the same server (vbulletin installation and domain2.tld)
- root shell access
- excellent system, hosting and vbulletin knowledge
- Canonical URL's disabled
- Probably no vbSEO (does not work on more than one domain at a single time)
First, you will have to create an empty and separate web space for domain2.tld. Run this code ... one by one in your shell:
Codice:
# touch mk-symlinks.sh
# chmod 700 mk-symlinks.sh
# nano mk-symlinks.sh
#!/bin/sh
#DBG=echo
src=/var/www/domain1.tld/htdocs
dst=/var/www/domain2.tld/htdocs
for i in `ls $src/`
do
[ "$i" = ".htaccess" ] && continue
[ "$i" = "anything else to exclude" ] && continue
$DBG ln -s $src/$i $dst/$i
done
exit 0
& save ;)
Important: You will have to run this script
every time you make a change to the structure or forum root files in your source installation.
At the Apache Record on the other hand, you will have to change a few settings the way it needs to access the other web space:
Codice:
<VirtualHost *:80>
ServerAdmin webmaster@domain2.tld
ServerName domain2.tld
ServerAlias www.domain2.tld
CustomLog /var/www/domain2.tld/weblogs/access.log combined
ErrorLog /var/www/domain2.tld/weblogs/error.log
DocumentRoot /var/www/domain2.tld/htdocs
<Directory /var/www/domain2.tld/htdocs>
php_admin_value open_basedir /var/www/domain2.tld:/var/www/domain1.tld/htdocs/
php_admin_value upload_tmp_dir /var/www/domain2.tld/tmp
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
& Reload Apache.
This is your basic setup. Now, domain2.tld should already be accessible, but eventually have some problems due to the fact there is no .htaccess file yet. Please create the file and add the following lines:
Codice:
# nano /var/www/domain2.tld/htdocs/.htaccess
RewriteEngine On
# Require fully qualified domain
RewriteCond %{HTTP_HOST} !^www\.domain2\.tld [NC]
RewriteRule ^(.*) http://www.domain2.tld/$1 [R=301,L]
RewriteRule ^$ forumdisplay.php?f=3 [L]
RewriteRule ^forum.php$ forumdisplay.php?f=3 [L]
& Save. Then, add the bottom lines specific to both installations from your source domain, such as SEO-frienly URL's and so stuff. Skip all lines which refer to old links, because domain2.tld is new! Don't forget saving :D
The f=3 indicates the forum category you wish to show in the domain2.tld domain as the "main" forum. It must be a category or a top-level section acting as new forum home, else it won't work. No parameters allowed.
Now you would go to the admincp in domain1.tld and make sure this forum section becomes invisible, but publicly accessible. Since you are an expert, no questions allowed on this :p
Then, you would add a few plugins to domain1.tld, which will inherit them also to domain2.tld (it's the same installation).
global_bootstrap_init_start:
Codice PHP:
<?php
/**
* @author Y2K Software
* @copyright (C) Copyright Y2K Software 2013 - All Rights Reserved
* @version 1.0.0
*/
// Set bburl
$vbulletin->options['bburl'] = "http://$_SERVER[HTTP_HOST]";
// Set other variables
$valid_sections = array();
$invalid_sections = array();
switch($_SERVER['HTTP_HOST'])
{
case 'www.domain1.tld';
// Remove invalid forum sections
$invalid_sections = array(3, 4, 5);
break;
case 'www.domain2.tld';
// Options
$vbulletin->options['bbtitle'] = 'Forum domain2.tld';
$vbulletin->options['webmasteremail'] = 'bounce@domain2.tld';
$vbulletin->options['contactusemail'] = 'staff@domain2.tld';
$vbulletin->options['keywords'] = 'anything,you,wanna,have';
$vbulletin->options['description'] = 'TITLE: domain1.tld';
$vbulletin->options['facebookappid'] = '';
$vbulletin->options['facebooksecret'] = '';
$vbulletin->options['styleid'] = 11;
$vbulletin->options['mobilestyleid_advanced'] = 11;
$vbulletin->options['mobilestyleid_basic'] = 11;
$vbulletin->options['allowchangestyles'] = 0;
$vbulletin->options['allowregistration'] = 0;
$vbulletin->options['WOLenable'] = 0;
$vbulletin->options['showevents'] = 0;
$vbulletin->options['showbirthdays'] = 0;
// Remove unwanted or redundant products
$vbulletin->products['vbblog'] = 0;
$vbulletin->products['vbcms'] = 0;
// Remove invalid forum sections
$valid_sections = array(3, 4, 5);
break;
}
// Remove invalid forum sections
foreach($invalid_sections as $key => $value)
{
unset($vbulletin->forumcache[$value]);
}
if($valid_sections)
{
foreach($vbulletin->forumcache as $key => $value)
{
if(!in_array($key, $valid_sections))
{
unset($vbulletin->forumcache[$key]);
}
}
}
This code makes sure that the extra sections are not shown or searched incidentally from the other forum or vice versa.
style_fetch:
Codice PHP:
// Set style: needed for queries and standard messages
switch($_SERVER['HTTP_HOST'])
{
case 'www.domain2.tld';
$styleid = 11;
break;
}
The styleid=11 wherever it appears, is the normally hidden style, which gives the external forum section a different look.
That's it. Enjoy.