Recent Topics

1 Sep 28, 2007 19:39    

My b2evolution Version: 2.x

Hi,

I am considering using b2evolution to run a few blogs, so I am running it locally, trying to see if I can set it up to do what I want. My idea is simple, running a few blogs on their own directories and one main blog aggregating all of them. B2Evo 2.x seems to be the perfect (and apparently the ONLY free) solution for that. Congratulations on the new version!

I am running through a problem, though, and was hoping someone here could help me out with it.

I installed b2 under the /blogs/ directory, logged with admin and deleted all blogs. I wanted a fresh start. So I created a new blog (called "firstblog").

I created a directory called /blogs/firstblog/ and copied a_stub.php there, renaming it to index.php. I set the base URL to "relative to baseurl: http://localhost/blogs/firstblog/";.

Since I wanted clean URLs, I set all the URLs for this blog to use extra path. The archives, as the config page tells me, should look like "ttp://localhost/blogs/firstblog/2007/12/31/".

As it turns out, this is what I get:

http://localhost/blogs/firstblog/2007/09/27/ goes to what is apparently index.php, with no CSS.

http://localhost/blogs/firstblog/index.php/2007/09/27/ goes to the right archive page

http://localhost/blogs/firstblog/index.php/2007/09/27 gives me a 404 saying b2evo couldn't find the archive.

I am not worried about the 404, but I wish I could not use the index.php bit.

I tried to mess around a bit and find out what it was, and my sense is that Apache can route it correctly to index.php when index.php is part of the url, but when I don't use index.php, it gets caught in the rewrite rule and goes to the MAIN index.php (/blogs/index.php). There, it tries to find the blog by URL (sending the whole URL), but it cannot.

I tried to "debug" a little bit, and ended up in _blogcache.class.php, #get_by_url method. The query it generates is this one:

SELECT * FROM T_blogs WHERE ( blog_access_type = "absolute" AND ( 'http://localhost/blogs/firstblog/2007/09/' LIKE CONCAT( blog_siteurl, "%" ) OR 'https://localhost/blogs/firstblog/2007/09/' LIKE CONCAT( blog_siteurl, "%" ) ) ) OR ( blog_access_type = "subdom" AND '://localhost/blogs/firstblog/2007/09/' LIKE CONCAT( "://", blog_urlname, ".localhost/%" ) )

I found it kinda weird that it tries to match the whole URL with only the siteurl (which is just the dir name), but I don't know much about b2evo, so the problem might be something else.

My blog_siteurl is "firstblog/", and my blog_urlname is "firstblog".

Sorry for the long post, and thank you very much for the new b2evo, it rocks!

Cheers,
Marcelo.

2 Sep 28, 2007 20:13

Ok, I did a quick "hack" and it worked, but since I might have broken something else, I'd like to post it here so someone from the dev team can take a look and see if this makes sense.

Since my blog uses blog_access_type = "relative", I added this to the query conditions in _blogcache.class.php#get_by_url ($sql variable - around line #120):

OR ( blog_access_type = "relative"
AND ( '.$DB->quote('http'.$req_url_wo_proto).' LIKE CONCAT("'. $baseurl . '", blog_siteurl, "%" )
OR '.$DB->quote('https'.$req_url_wo_proto).' LIKE CONCAT("'. $baseurl . '", blog_siteurl, "%" ) ) )

This tests the whole URL with the full URL of the relative blog.

Question: Will this break anything, or should this problem be solved somewhere else?

Thanks,
Marcelo.


Form is loading...