Subdomain Based Multilingual WordPress

Some days ago I wrote I was trying to setup this bilingual blog using different database tables but the same WordPress installation. This way I only have to upgrade my WordPress installation and plugins once. But I can still use different themes / language per subdomain if I want to do so.(and that’s great for experimenting).

Having this done is pretty easy. You have to change the part where you define your table_prefix in your config.php file to something similar to the code below.


$subdomain = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.'));
if ($subdomain == 'en')
{
$table_prefix = 'en_';
}
else
{
$table_prefix = 'wp_';
}

In this case I presume you want to link the subdomain ‘en’ to $talbe_prefix = ‘en_’ like I did for this website. If you want to use ‘english’ as a subdomain and you used ‘wp2_’ as table_prefix, of course you’ll have to use those values.

Now I only need to find a plugin that is able to scan the wp_content/uploads/ directory so I can use the same media in both blogs.

Golb’s Recommended WordPress Plugins

Simple CAPTCHA. Protect your blog against SPAM bots. Simple CAPTCHA doens’t require any coding and works extremely well and is easy to use. The big advantage of Simple CAPTCHA above Askimet is that it doesn’t give the SPAM bots the idea they could post something. After some atempts the bots will stop attacking you and will leave your blog aside. This makes a big difference on the server traffic and load.

Google XML Sitemaps: creates automatically a XML sitemap of your WordPress blog. These sitemaps can be used in Google’s “Webmasters Tools”, the ideal tool to monitor your sites healthiness.

Feedburner FeedSmith. First create an account on Feedburner.com, then install Feedburner FeedSmith plugin on your blog. In the plugin settings, fill in the address of your newly created Feedburner RSS et voila. You’re done. All you RSS feed subscribers will be forwarded to the Feedburner RSS. No coding is needed. The great thing about Feedburner is that you can have a better view on your RSS subscribers.

Yet Another Related Post Plugin. In an attempt to get a higher click-through rate I installed this plugin. Based on the tags, categories, url and titles, related posts are shown under each single page post.

WordPress Database Backup. Last but not least: a decent backup tool. You can choose to backup all your WordPress tables plus all other tables inside your database. Manually or automatically. You can store the backups on your server or you can use the mailing option. Works perfect.

Web Performance Matters

I’ve been in quite some discussions lately about web performance. As a product manager it’s my concern what people would think about our web solutions. As of the beginning of a long period of testing and during some demonstrations I had the impression that our web performance was below average.

When you talk about this to technical people (funny I used to be a techy as well, not so long ago) they start waving with figures and showing you everything is fine and within the agreed KPI of 8 seconds. And those 8 seconds are a well known standard…

8 seconds or not, I’m still having the impressing things are going slow so I started some research on the internet to find out who said that a website that loads within 8 seconds is fast. I bumped into an interesting website that unfortunately isn’t updated very frequent anymore but still contains valuable information: WebPerformanceMatters.com/.

Just as I thought: those 8 seconds are not a standard, but are a threshold. During studies in the 90ies they noticed that a little more than 50% of all visitors were still attached to the website if the load time was less then 8,5 seconds. Entertaining them with animated gifs or cursors could even manage them to wait a little longer. But we are talking about the 90ies here. That time you were a geek if you had a 128K modem using a ISDN land line. The customers’ expectation was not as high as today.

Today we are all using broadband internet connection, PC’s and servers with a lot more power. And the database technology also evolved to deliver more results in less milliseconds. Opening a website and having to wait for 8 seconds is just not acceptable anymore. Will 4 seconds be? Yes and no. It doesn’t matter how fast things are. If the perception is that it’s slow, the performance is bad. If you can manage to let your customer think it’s reacting fast you’re ok.

Also you’ll have to make a distinction between your website as a product or a support tool. If you are running a webshop or a newssite and your competitor is having a product that is 50% more performant, you’ll lose money. If you give your internal customers a support tool to check their own usage reports e.g. they’ll wait anyway as they really want to get their data. However, you can’t hostage your customers everlasting as this will impact your customer’s satisfaction quota.

Bottom line: you can’t prove performance with a figure. It’s a perception. If your customer isn’t happy, you have a problem. How do you know if your customer is happy: you’ll have to ask, but more important: you’ll have to listen!

Multilanguage WordPress Installation

WordPress is great, it’s easy to use and it does what it’s supposed to. Except for multilingual support. I already have a blog in Dutch: www.golb.be, and now I started another one in English (you’re looking at it). One way I could do this was to set up a sub domain and to install another WordPress installation in there.

Wouldn’t it be nice if WordPress would support this in the standard installation? I’m not looking for software or a plugin to translate each and every blogpost I make, but I would appreciate it if it would be possible to administrate both blogs from the same admin panel. If you have two separate installations, and two separate databases, you can’t easily reuse your media in your content folder and you have to upgrade your installations separately. Although the last part could be solved by making the config.php file sub domain aware. This option I still have to experiment with.

Wouldn’t it be nice if you could simply indicate the sub domain you would like the post to show up? I configured my server in such a way that all sub domains are pointing to www, but without losing the sub domain name in the URL. If the WordPress software would be smart enough to see which sub domain is used and to show only the posts related to that subdomain, that would be great.

I don’t think this is difficult to implement, and I could do this myself, but then I have to alter the WordPress database and I’m not sure it will survive future upgrades.

What do we need to change? Three things: a piece op php code to query only the posts for the relevant sub domain, a piece of php code to make the option available to save a post for a specific subdomain and the MySQL db to keep track which posts belong to which subdomain. Can’t be that difficult.

So why isn’t this not yet implemented? Probably because not everybody has full control over his web server and probably because not many people are asking for it. But can you imagine the benefit of it? Not only for multilingual websites, but also for people who want to make separate blogs per type of interest. Maybe even on different domains…