Setting The Front Page Per Language

To follow this tutorial, you need to enable the Path module.

The Path module allows setting the URL of pages. It comes together with Drupal, so you don't need to download and extract it.

Go to Administer > Site Building > Modules

Enabling the path module in Drupal

Setting The Same Home Path for All Languages

When a user comes to your site via yourdomain.com you want to direct them to the front page. When they come to your site via yourdomain.com/es you want to direct them to the Spanish front page.

In order to do this, you need to set the path to the home page node. That path must be the same for all language versions of the home page.

Then, go to the Site information admin page and set that path as the Default front page. Here is how to do this, step by step.

1) Setting the path for the default language home

Edit the node for your home page and set the path url - example: try setting it to "home".

Setting the path for the home page

Note: if you're using the Path-Auto module, make sure that it's disabled for the home page, so that it doesn't override the path you enter.

2) Duplicating the path for all translations of the home page

Do the same on the Spanish node that you want to be your home page and set the path url to the same value, "home" in this example.

Of course, Spanish is only an example here. You should repeat this for all translations of the home page.

3) Setting the same path in Site Information

Go to your Site information page /admin/settings/site-information and set the front page to the same as the URL path - "home" in this example.

front page

4) Testing

Save the configuration and test your urls. Use the language switcher to switch between languages. You should see the path in the browser showing only your domain name and the language code (without the path you've selected).

You can see it in action on this site:


Troubleshooting Home Page Path

You may get the following warning:

user warning: Duplicate entry 'home-es' for key 2 query: UPDATE url_alias SET src = 'node/126', dst = 'home', language = 'es' WHERE dst = 'home' in /home/bruce/drupal/drupal-6.13/modules/path/path.module on line 108.

This appears to occur if you have already used the alias before but on a language neutral page.

You can try editing the url aliases directly at /admin/build/path. Search for your alias name and delete the alias if the languages is showing "All".

Comentarios

Page not found for some languages

Hi

Thanks for the write up!! I had done the multilingual setup exactly as mentioned above. It was working fine.

After the site being live, I had a strange issue. For my multilingual setup, for some languages, it is displaying "Page not found". For some, it is working properly. Could anyone please help me in solving this issue.

Add the paths manually, not on node-edit-view

The same problem, also as below, Drupal 6, 404 on default language standard-home

SOLUTION: Add the paths manually http://***/admin/build/path/add
in all languages ​​required (I named it but perhaps it's not necessary) and it worked!

btw. Thx, very helpful drupal multilanguages tutorial, greetings from munich..

Activate Variable Translation!

I was having the same problem a lot of you mentioned: the front page content wasn't changing and i was going mad… (on a Drupal 7 installation)

Then i just realized your fron tpage is a variable and if you want it translated you have to activate Variable Translation first!
(that's something which isn't mentioned often… i guess ppl think everybody should just know it…)

Once it's activated, go to Configuration > Multilingual Settings > Variables and activate the variable(s) you need to be translated (in our case the default front page)

After that, everything's working for me

Setup with several domain names in D7

I was searching how to setup with several domain names.

First : in Config > Regional and language > Languages > Detection and Selection => enable URL then configure check domain.

Second : in Config > Regional and language > Languages edit each language and setup the domain name

Thrid : login in each website to setup the Default front page in Config > Site information

That's all

Thanks!!!!!!!

I was going crazy with this issue. You did my day!
Thanks a lot :)

on drupal 7.x doesn't works for me

Hy, i followed the steps mentioned above, but my home page doesnt wants to change from the default site language.
I also installed the internationalization package which works well with the content, any suggestions? http://aut.net63.net

I set a view filter for content translation. that could be the problem?

Don't work for me to in Drupal 7

I have all latest versions of drupal and internationalization module.

I did all these steps and i just see the main language node in homepage.
The other languages dont appear in homepage.
All blocks in my homepage are translated automaticaly but the node associated to the page is not :(

Thanks

It just worked!!!

These directions did the

These directions did the trick perfectly on a 6.x site. Thank you!

Does Not Work

I am using Drupal 6.20. I have tried using internalization stable and dev as well as applying patches and nothing is working. Can somebody try and figure out why this is happening?

default language

Hi, I'm experiencing a problem with my default language.

I have a multi-language Drupal site with BG (Bulgarian) and EN (English). Everything seems to work fine except the default language for my home page (en/home and bg/home). I read what to do in the How-to guide in Common questions, but the solution described there won't work for me.

Is rewriting the address with .htaccess my only option ?

Thanks.

Front page at different language

On Drupal 6.24, set to use prefix only, put "<"front">" /without all quotes/ as path for home page in "Site information", for both languages. It worked for me.

Solution

Hi,

I have experienced the same problem and I managed to solve it by specifying prefix for both languages. Then I have edited site info for:

English:
example.com/en/admin/settings/site-information
and specified -Default front page:
example.com/en/ node/7 (number of home English)

and Polish:
example.com/pl /admin/settings/site-information
and specified -Default front page:
example.com/en/ node/11 (number of home Polish)

Hey, I have a slightly

Hey, I have a slightly different problem. Instead of language sufix like you /pl i have two different domains. One for enlish, one for dutch.

but when I try to set default frontpages on the two different sites, i can't. It just always applies my choice to both languages.

Thanks a lot

You had the solution for me, thanks a lot !

It worked!

After a lot of trial and error, this is actually the only thing that worked for me. Thanks a lot!

edit links

hi,
im having the same problem can you please direct me where can i edit it? i have tried to find the place to edit it but no luck..
thanks :)

You can edit the languages

You can edit the languages under /admin/settings/language

default path prefix

i am trying to solve a related problem and wonder if you could help.

except for auto redirection to the default language path prefix, my multilingual configuration works properly.

if i go to www.example.com, it won't switch to the default language path prefix on its own. it is always english, while english is set up as www.example.com/en like any other language and it is not the default one.

i could solve it of course through .htaccess rewrite rules if i used "language domain" rather than "path prefix", but this option is buggy and adds many redundant prefixes to the path.

really hope you have an idea. cheers, monti

Language Switcher fails on homepage

Another problem is with the language switcher. Using the translation links on a node I translated to 2 other languages works. Also the menu links change correctly. Now though if I click on the language on the language switcher it fails to work. I noticed that for the page set as the main page ( with the default language content ) the language switcher does not link to the correct translation pages but to http://yourhost without the correct path afterwards. Looks like for the node set as the default page the language switcher messes up and fails to output the correct links. If I am on a translated version of the same node the language switcher does show the correct links. Any ideas on what could cause this?

Language Switcher

I had this problem, too.
Decided: go to Language/ edit English. Set prefix for it (all language must have prefix).

Does not work

Does not work here for some reason. Following the steps but when I use yourhost/de or any other language prefix I get 404 error. Anything particular you have to enable to get this working outside of what you mentioned on this page?

It could be something to do with the language negotiation

Go to /admin/settings/language/configure and set the negotiation to path prefix only or path prefix with language fallback.

I did that but it's still not

I did that but it's still not working ( getting 404 )

404 Error - Solution

Finally I found the solution for the 404 error.

The default frontpage nees to be applied for EACH language (didnt know that). In my case for:

---> admin/settings/site-maintenance
---> /en/admin/settings/site-maintenance
---> /es/admin/settings/site-maintenance

regards
hilrap

this doesn't work for me

Hi I've tried this but when i change the value in one language, it updates in the other.

I have added the multilingual variables so I do see the "This is a multilingual variable" next to the field, but still this changes all values.

Anyone had this issues before ?

same problem

can you tell me what was your solution for this issue?

Solution for 404 error?

Same me! mydomain.com/en and mydomain.com/es respectively, will give me 404 error (page not found). My default language is German (without any prefix)...
Has there been any solution for this ?

Much appreciated!! :-)

Beware of English path prefix!

First of all, big thanks for your write up, this helped a lot!

I did have one strange thing, I have a site in 3 languages, Dutch, French and English, with Dutch the default language. After I applied your suggestions, the front page language switcher worked for Dutch and French, but not for English. After some trail and error, I found out that by default the path prefix for English is empty. Changing this to "en" made the language switcher on the front page work for Engish too.

Thanks.
Nick.

It does not work with more than one page to be promoted to front

Thanks, this is a great solution.

But, what happens when we have more than one page promoted page?

You don't need a homepage

I had the same problem, but I seem to have figured it out, at least for my site.

I set up an url alias with the system path as 'node' for all languages.

Then I added the alias /home

Whenever you reference 'home' it just points at the standard frontpage.

My problem was going from the homepage to a section in my site.
Then I would switch the language and click back to the homepage.

When I got to the homepage, despite the url reading /en (my default is /ja )the links would not include the English prefix.

This fixed it.
However this is a mobile site and I am referencing the homepage via the header image which I have point at the homepage in the page.tpl template.


language.'/home'; ?>"" >
/>

So it might not be for everyone.

This was driving me crazy -

This was driving me crazy - thanks a lot for this article, it worked flawlessly.

SQL error

hello,

by strictly following these steps,
i got this error :

user warning: Duplicate entry 'home-fr' for key 2 query: UPDATE vt_url_alias SET src = 'node/2', dst = 'home', language = 'fr' WHERE dst = 'home' in /homez.184/legren/www/vt_dp/modules/path/path.module on line 108.

what bugs me is the "WHERE dst='home'", whereas you wrote that it was ok for naming both english & foreign urls as "home".

do you have a hint please ?

Can you try this patch

http://drupal.org/node/269877#comment-1338984

There is a lot of discussion about this problem here: http://drupal.org/node/269877

Let us know if this fixes it for you.

Works well

thanks a lot, it works perfectly !
opi

duplicate path

Drupal reported duplicate path while configuring the same url alias of both languages.

path settings

You may need to activate the path module in order to access URL path settings when editing nodes.

Right, the path module needs to be active

Drupal depends on the path module in order to set 'fancy' paths to nodes, so it must be enabled for this to work.

How?

Where do I find this URL path settings, as seen in step 1?

"The path is already in use." error

Hi

I tried to follow this advice but wasn't surprised to find that Drupal will not accept a URL alias that is already in use.

Am I misunderstanding in some way ?

Thanks

Dave

You get "The path is already

You get "The path is already in use." error if you don't turn on multilingual support for the content type. Go to admin->settings->content type. Choose page for example and turn on the multilingual support under Workflow Settings