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!
How do you show the message ‘Notify me of followup comments via e-mail’? It’s a skin tag? I haven’t found it on the docs!
Hum, sorry me 🙂 I thought that it was a b2evo blog 🙂
Well, it was a b2evo blog once upon a time. I love b2evo and even made a donation to the development team. I wish them well.
I was forced to switch back to wordpress in some cases because I needed features (via plugins) that were not yet available on b2evo. And, I did not have time to develop them myself due to other priorities.
There are things about b2evo that are superior to wordpress — it’s just a little too early in the development lifetime for me to play.
Mark, before I try this, can you tell me why this works? Are there any implications to it to my other add-on sites?
Mark — You should know that I wrote this post a lifetime ago (Dec 2007). I strongly recommend that you talk to the guys over at b2evo. They are brilliant, and they can help you (use the forum).
I switched to WordPress in January of 2008 and have lost track of the development of b2.
Why this works (or worked in 2007): Basically this approach uses sym links to make sure the relative paths in the b2 code find all the files that they need to find. The stub file allows you to find an “index.php” file in the domain that you are adding. Put the two together, and the only problem you have left is login cookies. I solved that (above) but do not really understand the solution.
No — this should not impact any other addon domains that are running separate b2 installs or other software.
So, again, I strongly recommend that you talk to the b2 evo developers before proceeding if you are adverse to down time.