[wp-hackers] 2 URLs 1 WordPress install

Justin Kerr Sheckler sheckler at nytimes.com
Thu Jul 27 14:25:17 GMT 2006


Try putting some sort of logic into wp-config.php that chooses which db 
to connect to:

if ($_SERVER['HTTP_HOST'] == "site1.mydomain.com") {
    define(DB_NAME, "site1_db");
} elseif ($_SERVER['HTTP_HOST'] == "site2.mydomain.com") {
    define(DB_NAME, "site2_db");
}

Kludgy, but effective.  Should work for admin as well as frontend.  
You'll also need access to your server setup, so you can define the same 
docroot for all subdomains.

-JKS

R.J. Kaplan wrote:
> Hi,
> How are you doing this? with one database or two? I've figured out a 
> way to use 1 install for 2 (or more) different domains (on the same 
> server) with separate databases, but the only thing I ddidn't work out 
> is the admin section, it doesn't know which database to work on.
> Just curious about how all this works.
> ~Joe
>
> On Jul 27, 2006, at 8:20 AM, Mark Harwood wrote:
>
>> Hi guys,
>>
>> I was wondering if anyone knew the correct way of getting a single 
>> WordPress install to work over two domains?
>>
>> I currently have mem-gaming.co.uk/v2/ and midnightevil.co.uk/v2/ 
>> running off the same install.
>>
>> But of course in the theme i use get_bloginfo quite a bit, so how can 
>> i get around the fact that WordPress thinks its only installed on 
>> mem-gaming.co.uk domain?
>>
>> Cheers
>> Mark
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list