Posted in : Techno Babble
That was tough huh?
Ok, this is the drawback to this method, all of your domains/subdomains share the same folder so, unless you trust all your users, ftp access is probably out of the window
...... obviously, the fact that it's a single install makes maintenance/upgrades a lot easier.
The only two ways I know how to set this up ( unless you class "ask yer bloody host" as an answer ):
Code:
<VirtualHost *:80> | |
ServerName innervisions.org.uk | |
ServerAlias www.innervisions.org.uk waffleson.co.uk www.waffleson.co.uk | |
DocumentRoot /path/html | |
suPHP_UserGroup user | |
</VirtualHost> |
Yay, multiple domain/subdomain blogs on a single install, nirvana is achieved ....... actually, not quite. You'll soon start noticing that you're only logged in when you're on the main domain, so if you're on a subdomain ( or another domain ),private/protected posts suddenly become lost in the ether, and any edit/publish/deprecate/delete icons that might normally be shown in your skin! ....... "where have they gone?" I hear you ask. The problem is, you're not logged in and, it gets worse, you can only login to the main domain ( the one you set your $baseurl for ) .... yer screwed.
You can actually solve the login problem in a couple of ways, which you use depends if you're using subdomains or domains, if you're using both then ( weirdly enough ) you'll use both solutions ![]()
For separate domains you need to crack open your /conf/_basic.config.php and uncomment some bits that are niftily commented by the evo team to show you how to do it ![]()
PHP:
/** | |
* $baseurl is where your blogs reside by default. CHECK THIS CAREFULLY or nothing will work. | |
* It should be set to the URL where you can find the blog templates and/or the blog stub files, | |
* that means index.php, blog_b.php, etc. | |
* Note: Blogs can be in subdirectories of the baseurl. However, no blog should be outside | |
* of there, or some tricky things may fail (e-g: pingback) | |
* | |
* IMPORTANT: If you want to test b2evolution on your local machine, do NOT use that machine's | |
* name in the $baseurl! | |
* For example, if your machine is called HOMER, do not use http://homer/b2evolution/blogs/ ! | |
* Use http://localhost/b2evolution/blogs/ instead. And log in on localhost too, not homer! | |
* If you don't, login cookies will not hold. | |
* | |
* @global string $baseurl | |
*/ | |
$baseurl = 'http://localhost/b2evolution/blogs/'; | |
// Use the following if you want to use the current domain: | |
/* | |
if( isset($_SERVER['HTTP_HOST']) ) | |
{ // This only works if HOSt provided by webserver (i-e DOES NOT WORK IN PHP CLI MODE) | |
$baseurl = ( (isset($_SERVER['HTTPS']) && ( $_SERVER['HTTPS'] != 'off' ) ) ?'https://':'http://') | |
.$_SERVER['HTTP_HOST'].'/'; | |
} | |
*/ |
For subdomains you need to meander over to conf/_advanced.php and play with the cookies, which has once again been niftily commented in a useful way by the evo team ![]()
PHP:
// ** Cookies ** | |
| |
/** | |
* This is the path that will be associated to cookies. | |
* | |
* That means cookies set by this b2evo install won't be seen outside of this path on the domain below. | |
* | |
* @global string Default: preg_replace( '#https?://[^/]+#', '', $baseurl ) | |
*/ | |
$cookie_path = preg_replace( '#https?://[^/]+#', '', $baseurl ); | |
| |
/** | |
* Cookie domain. | |
* | |
* That means cookies set by this b2evo install won't be seen outside of this domain. | |
* | |
* We'll take {@link $basehost} by default (the leading dot includes subdomains), but | |
* when there's no dot in it, at least Firefox will not set the cookie. The best | |
* example for having no dot in the host name is 'localhost', but it's the case for | |
* host names in an intranet also. | |
* | |
* Note: ".domain.com" cookies will be sent to sub.domain.com too. | |
* But, see http://www.faqs.org/rfcs/rfc2965: | |
* "If multiple cookies satisfy the criteria above, they are ordered in | |
* the Cookie header such that those with more specific Path attributes | |
* precede those with less specific. Ordering with respect to other | |
* attributes (e.g., Domain) is unspecified." | |
* | |
* @global string Default: ( strpos($basehost, '.') ) ? '.'. $basehost : ''; | |
*/ | |
if( strpos($basehost, '.') === false ) | |
{ // localhost or windows machine name: | |
$cookie_domain = ''; | |
} | |
elseif( preg_match( '~^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$~i', $basehost ) ) | |
{ // Use the basehost as it is: | |
$cookie_domain = $basehost; | |
} | |
else | |
{ | |
$cookie_domain = preg_replace( '/^(www\. )? (.+)$/xi', '.$2', $basehost ); | |
| |
// When hosting multiple domains (not just subdomains) on a single instance of b2evo, | |
// you may want to try this: | |
// $cookie_domain = '.'.$_SERVER['HTTP_HOST']; | |
// or this: -- Have a cookie domain of 2 levels only, base on current basehost. | |
// $cookie_domain = preg_replace( '/^( .* \. )? (.+? \. .+? )$/xi', '.$2', $basehost ); | |
// fp> pb with domains like .co.uk !? | |
} | |
| |
// echo $cookie_domain; |
Now that wasn't hard .... was it ![]()
¥
Trackback URL (right click and copy shortcut/link location)
Trackback url for this post
Note : This trackback url is time limited so use it within 30 minutes or the SpamHound will snarl at you.
http://waffleson.co.uk/z/?k=36752602633103238a92880404fc898d116163d714eeef4e5
Gary
Reply to comment 14318 by Gary