Wiki style: multilingual subdomain on 6.x

Drupal 6.x comes with some nice multilingual features: I want to use these to transform my multilingual website from “prefix path” ( to language subdomains ( I like this method on Wikipedia, so it will be a nice additions to my Drupal wiki site.


  • Drupal 6.x (tested on Drupal 6.x)
  • A sites/default directory with a settings.php file pointing to your database (locally). You can alternatively create one “sites/” directory on production website. Setting for subdomains will be read here.

If you want to test this on your local machine before any production use, change your /etc/hosts file adding near “localhost” your language subdomains (I will use english* and italian*). localhost example en.example it.example

Go to your Apache configuration (usually /etc/apache2/sites-available/default) and copy your local configuration for each server name (copy and change bold declaration, eg. example it.example en.example).
Note: skip this step if you want to configure subdomains. I use this configuration on my local test machine, but I use subdomains (configured via CPanels) on production website.

<VirtualHost *>
ServerName example
DocumentRoot /var/www/
<Directory “/var/www/”>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from ::1/128

<VirtualHost *>
ServerName it.example
DocumentRoot /var/www/
<Directory “/var/www/”>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from ::1/128

Now visit http://en.example and http://it.example. You should login to these site before proceed, otherwise you cannot set a language URL.

Now, on http://example/ (your localhost server name for this site)

  1. go to Admin > Languages > Configure
  2. set Language negotiation to Domain name only
  3. Save settings
  4. go to Admin > Languages > List and edit a language (you may have to enable it with add language)
  5. On Language domain for english type http://en.example. Do the same (with it subdomain) on Italian language configuration.

Now you can download and install Internationalization module. After that:

  1. Go to Admin > Content types > Your-content-type (tipically Page or similar)
  2. On Workflow settings select Enabled, with translation

Now, create a page selecting “English” as language. Save it and go to Translate tab, then add a translation in the other language. On the bottom of the page you can see a language switcher. Click on it and watch your URL.

If you use Path alias (and/or Pathauto module) you can use the same alias for any subdomain. Why? Because {url_alias} table comes with a nice “language” field. If I want to have two different articles about Ritsuko Akagi, one in English and the other in Italian, using the same path alias, my database table {url_alias} will contains:

pid 	src 	        dst 	                language
6  	node/3  	wiki/Ritsuko_Akagi  	it
8  	node/4  	wiki/Ritsuko_Akagi  	en


That’s all.

2 responses to “Wiki style: multilingual subdomain on 6.x”

  1. Thanks Thomas.

    Update: When passing from local to production site or vice-versa, you have to change drp_languages table manually to specify the correct domain.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: