In this post, I try to describe what I did to get multiple b2evo blogs running on a shared host using only one install of b2evo. I did this on a Lunarpages shared host using b2evo 2.20.

Note that this was only possible because b2evo rocks, and because of help I got on b2evo forums. I did not do anything special.

Comments about this post appreciated.

  • Install b2evo on your primary domain in a sensible subdirectory. I installed in the blogs subdirectory. Let’s say my path was /home/myuserid/public_html/blogs and lets say my primary domain is foo.com
  • Make sure b2evo is working on the primary domain
  • Create the other domains on your host. Mine uses cpanel and the new domains are referred to as add-on domains. Adding on domains makes subdirectories on my host under public_html. This is where apache looks for files. Lets say we created an “add-on” domain in cpanel for bar.com. This would create a directory /home/myuserid/public_html/bar on my host. Similarly, adding null.com would create /home/myuserid/public_html/null and so on.
  • Place a symbolic to the real blogs directory from each domain directory. For example, create a symlink from /home/myuserid/public_html/bar/blogs pointing to /home/myuserid/public_html/blogs. From a shell, this would be accomplished with the command ln -s /home/myuserid/public_html/blogs /home/myuserid/public_html/bar/blogs
    The only way I know to do this in cpanel is with the cron tool. Yuck.
  • In the backoffice, create each of your blogs. Note the blog id.
  • In the backoffice, set the URL reference to absolute for each blog. Make the URL for the null blog look like http://www.null.com/, etc. Note the training slash.
  • Create a stub file for each blog called index.php in default directory for each domain. For example, index.php stub file for the null.com blog needs to reside in the /home/myuserid/public_html/null
  • Do whatever you need to do in your installation of apache to make sure that index.php will be loaded by default. My apache install already does this, and I cannot remember where to set it on a cpanel host.
  • In each stub file, set the correct blog number
  • Make sure that the stub file is calling _config.php from the correct place. For example, check this line: require_once dirname(__FILE__).’/blogs/conf/_config.php’; This is what I use the symlink for.
  • Create a .htaccess file in each default directory (e.g. ./public_html/null) that turns on mod_rewrite rules for your domain. I have: RewriteCond %{REQUEST_FILENAME} !-d; RewriteCond %{REQUEST_FILENAME} !-f; RewriteRule ^ index.php
  • Edit your ./public_html/blogs/conf/_basic_conf.php file to compute the $baseurl based on isset($_SERVER[’HTTPS’]). You can do this by uncommenting the code that is there.
  • Edit your ./public_html/blogs/conf/_advanced.php to set your cookie path to root: $cookie_path = “/”;. Note that I do not understand why this works or exactly what the implications are. You still need to log on to each domain, and I still see weird cookie behavior. However, this “mostly” works.

That’s all I can think of at the moment. If you post comments/questions, I will modify the post to clarify.

Thanks!

TEST