Drupal : how to host multiple drupal sites using only one url on linux

Posted by: 
Dominique De Cooman

We have two sites a Dutch site and a French site and we want to host it under one url.
Setup your folders in de sites folders. Create a directory for the french site and create a directory for the dutch site. Both will have their own settings file.
In the root of your drupal installation create two symlinks. The two symlinks will point back to the root of your site.

ln -s /var/www/yoursite/ nl 
ln -s /var/www/yoursite/ fr

In the sites folder create the following symlinks.
ln -s /var/www/yoursite/sites/yoursite-dutch yoursite.ext.nl
ln -s /var/www/yoursite/sites/yoursite-french yoursite.ext.fr

When surfing to yoursite.ext/nl drupal will now look for a folder named yoursite.ext.nl in your sites folder, it will find the symlink and will be redirected to /var/www/yoursite/sites/yoursite-dutch and find the correct settings file.

Finaly you ll want people to land on a default site or perhaps you ll want to create a page where people make their choice. This is where the default settings file (sites/default/settings.php) will be used.
On the first line put this:

header('Location: "<a href="http://yoursite.ext/nl/"'">http://yoursite.ext/nl/"'</a>);

When users visit <a href="http://yoursite.ext">http://yoursite.ext[/geshifilter-codes] they ll be redirected to <a href="http://yoursite.ext/nl/">http://yoursite.ext/nl/[/geshifilter-codes] which is the dutch version of your site.

Add new comment

Who are you?

By knowing who you are you will be directed to a page where we have displayed all our drupal services relevant to your professional identity.