Multi-domain test-environment
From b2evolution manual
This manual page is outdated. NEW PAGE: Multi-domain Test-environment in b2evolution v5+.
[edit] In versions 1.x
First, when testing a single domain, you should always use localhost and not the IP address of your machine, nor the windows name of your machine. Trust our experience that cookies may act weird on the IP address or the windows name. On localhost they work like they do in real life (on full domain names).
Now, in order to test b2evo on multiple domains all from the development machine, the easiest thing is to set up some fake domains for use in the test URLS.
Open the hosts file with a text editor. On Windows XP this is C:\WINDOWS\system32\drivers\etc\hosts .
This file is where localhost is defined. Like this:
127.0.0.1 localhost
Add the following lines:
127.0.0.1 all.b2evo.local 127.0.0.1 a.b2evo.local 127.0.0.1 b.b2evo.local 127.0.0.1 links.b2evo.local
Using these domains in the URL will produce the same results as localhost, except cookies won't be shared...
To tie the blogs to these URLs, you must set their absolute URLs accordingly in the admin.
See also MultipleDomains.
[edit] Versions prior to 1.x (no 100% sollution)
- Use stub files to manage access to the various domains or subdomains - index.php in each virtual host's DocumentRoot folder (see b2e docs for more info on this.)
- In the stub file, add a line to set the variable $baseurl to
http://www.yourdomain.com- no trailing slash! There should be just one of these lines per stub file. Like this:$baseurl = 'http://www.yourdomain.com'; - In your b2evolution installation's conf/ folder, edit _config.php:
- Look for the line that says
$baseurl = 'http://www.yourotherdomain.com'; - Change it by inserting the following code at the begining of the line:
'if(!isset($baseurl))'
- Look for the line that says
- The finished line should read something like:
if(!isset($baseurl)) $baseurl = 'http://www.yourotherdomain.com';
This allows the stub files to override the $baseurl variable in the _config.php file.
There may be other things that need tweaking - most notably, comments may not work. On *nix servers, you can fix this by symlinking the 'htsrv' folder into each domain/subdomain's root folder (where you keep a stub file for each.) Windows servers, I haven't had time to test.
You may also need to set a tag in each site's skin _main.php file, depending on whether your site draws elements from a main site (i.e. a skin for blog.mydomain.com may need a BASE HREF pointing to www.mydomain.com if it uses images or stylesheets from the main site.)
