Recent Topics

1 Oct 14, 2012 03:25    

My b2evolution Version: 4.1.x

I have b2evo 4.1.5 installed in the subdirectory /blog/ on my web host, and at any request to /blog/ goes to my current default blog.

I wanted to add a second blog at an entirely different domain name, so I added this domain to my web hosting account and pointed it to the same directory where b2evo is installed, /blog/. I then added the new blog in b2evo and configured it's URL to be an absolute URL to http://newdomain.com/.

When I navigate to this URL, I get the right blog :)

However, there's some odd behaviour that I'm not really sure what is going on.

If I go to http://olddomain.com/blog/admin.php and log in, I create a new post on the new blog.

However, when I navigate to http://newdomain.com, the correct blog comes up, but the post doesn't show (though, I am able to navigate to it if I know the full URL to that post, e.g. http://newdomain.com/2010/10/13/Hello)

If I play around with the URL settings for this new blog (e.g. change it to Explicit Param on Index), the missing post magically appears. If I then change it back to the absolute domain name, the post remains (doesn't disappear).

Also, something that was odd was that if I navigate to: http://newdomain.com/admin.php, I get automatically redirected to http://olddomain.com/blog/admin.php.

Am I missing something still? I tried following some of the advice on the wiki: http://manual.b2evolution.net/MultipleDomains

But setting the cookies didn't seem to do anything. And setting the htsrv broke my login completely (kept on kicking me to the login page after entering my credentials).

Any ideas? It sounded like it should have been so simple, but I'm not sure what's going on.

2 Oct 14, 2012 04:07

Ook, I figured it out; I think.

I had to do some work with the $baseurl setting in _basic_config.php.

I had to put in a small hack to catch when I was going to my default site, and set the base URL to the original one.

If not going to the default site, then I let it just pick it off of the $_SERVER['HTTP_HOST'] per the comments in _basic_config.php.

This is because I needed to have two different types of baseurls:

http://olddomain.com/blog/
http://otherdomains.com/

It's that subdirectory that was throwing everything off..

So I modified it to look something like this:


if( isset($_SERVER['HTTP_HOST']) )
{	// This only works if HOSt provided by webserver (i-e DOES NOT WORK IN PHP CLI MODE)

	if (strpos('olddomain.com', $_SERVER['HTTP_HOST']) === FALSE)
	{
	$baseurl = ( (isset($_SERVER['HTTPS']) && ( $_SERVER['HTTPS'] != 'off' ) ) ?'https://':'http://')
							.$_SERVER['HTTP_HOST'].'/';
	}
	else
	{
		$baseurl = 'http://olddomain.com/blog/';
	}
}


Form is loading...