Posts Tagged ‘WordPress’

BuddyPress is coming

Saturday, June 14th, 2008

Watch out Facebook (which irritates me enough already) and Ning, BuddyPress is coming. OMG!

6 steps to host WordPress on multiple domains

Tuesday, March 18th, 2008
I’ve actually planned to host this site on different domain names. Since, I can’t afford the for another domain name (yet), it remained just an idea until some one made me to, at least, test if it would work.

And so, it does work. One can access this site on poppacket.blogrunn.com and poppacket.com. Basically the idea is to host one WordPress instance on multiple domain names by using advanced options in wp-config.php and domain pointer.

This is not a redirection. The domain name(s) in use will remain intact site-wide. Take a site with domain names abc.com and xyz.net for example. If one access a WordPress page at http://xyz.net/about, it will appear as such instead of being redirected to http://abc.com/about. All internal links - for posts, pages, feeds, theme files, plugin files, admin panel, et al. - will appear as xyz.net as well.

Why would you wanna do this?

I had the idea to do this quite some time ago when some one asked on WordPress Support Forums how to set up his wedding site using WordPress with two domain names. One that started with his name first and the other with the bride’s name first. It was a really cool idea or so I thought.

Another reason why you want to have multiple domain names on one website is to protect your names from being used for unproductive profit-making activities. This is particularly important if your names are famous. Say, for example, you were one of the world’s biggest superstar, you wouldn’t want the .net or .info domain names that bear your name show useless stuffs. Or if you were the world’s biggest selling marketing guru, you wouldn’t want your .net domain to be forwarded to the website of some family walk-in clinic.

I am using this method in a number of projects that I am working on where one WordPress instance is used as CMS for multiple websites with unified users management. This will make maintenance much easier especially when administering multiple websites single-handedly.

It will also be useful for websites with the same target users. The content on each website may be different but registered users can access their accounts on multiple websites with a single login. Contributors and authors also don’t need different logins to write a post on the websites.

What you need?

  • Meet WordPress requirements
  • Domain Pointer (or Domain Parking) provided by your web host

N. B. The method will only work with WordPress version 2.2 onwards.

How?

1. Install WordPress the usual way on the first domain name. For the purpose of this example, we call it ilovecookies.com.

2. Say your second domain name is cookiesforall.net. Now, log in to your hosting control panel and go to ‘domain pointer’ (sometimes also known as ‘domain parking’).

3. ‘Point’ (or ‘park’) cookiesforall.net to ilovecookies.com.

4. Edit wp-config.php by adding the following codes after the $table_prefix line:

$hostname = $_SERVER['SERVER_NAME'];
$hostname = str_replace(’www.’, ”, $hostname);
if ($hostname == ‘cookiesforall.net’) {
define(’WP_SITEURL’, ‘http://cookiesforall.net’);
define(’WP_HOME’, ‘http://cookiesforall.net’);
}

5. Take a nap.

6. Voila!

N.B. In the example above, it is assumed that WordPress is installed at the public root, whilst your WordPress address and Blog address (in wp-admin/general-options.php) are set to http://ilovecookies.com.

If you have something like http://ilovecookies.com/wordpress or http://ilovecookies.com/blog, then change the forth and/or fifth lines in step 4 above accordingly.

What about more than two domain names?

For subsequent domain names, for each, add to the codes above the following:

elseif ($hostname == 'whotookmycookies.org') {
define('WP_SITEURL', 'http://whotookmycookies.org');
define('WP_HOME', 'http://whotookmycookies.org');
}

So now, you have ilovecookies.com, cookiesforall.net and whotookmycookies.org.

If, for example, on top of the three above, you have ohmycookies.info, the codes would look like this:

$hostname = $_SERVER['SERVER_NAME'];
$hostname = str_replace(’www.’, ”, $hostname);
if ($hostname == ‘cookiesforall.net’) {
define(’WP_SITEURL’, ‘http://cookiesforall.net’);
define(’WP_HOME’, ‘http://cookiesforall.net’);
} elseif ($hostname == ‘whotookmycookies.org’) {
define(’WP_SITEURL’, ‘http://whotookmycookies.org’);
define(’WP_HOME’, ‘http://whotookmycookies.org’);
} elseif ($hostname == ‘ohmycookies.info’) {
define(’WP_SITEURL’, ‘http://ohmycookies.info’);
define(’WP_HOME’, ‘http://ohmycookies.info’);
}

Some people who I introduced this trick to said it didn’t work for them. Most of which, I didn’t know why. I’ll help where I can. But if it worked, I would love to hear from you.

WordPress gonna make social platform

Wednesday, March 5th, 2008

WordPress gonna make social platform to be known as BuddyPress. So who’s joining the social boat next?