[wp-hackers] Re: 2 URLs 1 WordPress install

Francis Reyes Francis.Reyes at colorado.edu
Fri Jul 28 21:35:56 GMT 2006


I've written up my experiences on multiple wordpress blogs on a single 
installation at 
http://ruckerz.oldbrownshoe.org/2006/07/28/multiple-wordpress-blogs-on-a-single-installation/

Comments welcome.

FR



Dougal Campbell wrote:
> Robert Deaton wrote:
>> On 7/28/06, Mark Harwood <mark at phunky.co.uk> wrote:
>>> Yes your right, its ONE site but with two domains - it already works in
>>> a sense
>>>
>>> www.mem-gaming.co.uk/v2/
>>> www.midnightevil.co.uk/v2/
>>>
>>> both go to the same site and pull the WordPress stuff, i was just in
>>> need of sorting out the URL links. i think i will just remove the 
>>> use of
>>> bloginfo() for grabbing the URL out of the DB and instead just grab the
>>> serveruri directly from the domain.
>>
>> A better and more reliable thing to do might be using a filter on
>> bloginfo or the options to modify the domainname instead of removing
>> them from the picture altogether.
>>
>
> That's just what I was about to suggest -- hook into the 'bloginfo' 
> filter, check against $_SERVER['HTTP_HOST'], and return different info 
> as needed. Something like
>
>   function twoblogs($text) {
>     $hostmap = array( 'host1.example.com' => 'host2.example.com',
>       'Host One Blog' => 'Blog on Host Two');
>
>     if ($_SERVER['HTTP_HOST'] == 'host2.example.com') {
>       $newtext = $hostmap['$text'];
>       if (empty($newtext)) {
>         $newtext = $text;
>       }
>     }
>
>     return $newtext;
>    }
>
>   add_filter('bloginfo', 'twoblogs');
>
> In the $hostmap array, just put in mappings for whatever bloginfo 
> strings should be different between the two hosts.
>
> Make sense?
>



More information about the wp-hackers mailing list