Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Vincenzo 5 years, 7 months ago.

Assigned support staff: Vincenzo.

Author Posts
March 22, 2015 at 8:42 am #584797

Niels Harland

I am trying to properly set-up a multi-lang website. I have translations for all my content.
I've seen many questions alike, but none with a clear and satisfying answer:
- I want to use virtual directories for each language
- Including the default
- I want to redirect users either to their language's specific homepage or the default language's homepage
- I don't want a non-translated root/landing page e.g.

This seems to me a very logical core functionality, so I'm wondering if I'm doing something wrong in the configuration.

Thanks in advance!
Niels

March 23, 2015 at 1:56 pm #585558

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+01:00)

Hello Niels, thank you for contacting WPML support.

you can try the following steps:

1. In WPML -> Languages :
- Select 'Different languages in directories'
- Enable 'Use directory for default language'
- Select 'HTML file'
- insert 'lang.php' inside the text field below

2. In WPML -> Languages -> Browser language redirect :
- Select 'Redirect visitors based on browser language only if translations exist'

3. In your WordPress installation root directory, the same where you can find your wp-config.php file:
- add a new file and name it 'lang.php' .
- edit this file with a text editor and insert the following code (change the URL according your preferred default language):

<?php
 
   header( 'Location: <em><u>hidden link</u></em>' ) ;
 
?>
           

Let me know if this works in your setup

March 23, 2015 at 2:19 pm #585584

Niels Harland

Hi Vincenzo,

Thanks for the info, I've just tried this: unfortunately this causes the site to redirect to de default no matter what the browser language is.

March 23, 2015 at 3:06 pm #585648

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+01:00)

Please clean your browser cache and cookies or try with another computer because of this setting:

WPML -> Languages -> Browser language redirect -> Remember visitors' language preference for 24h

Let me know

March 28, 2015 at 8:23 am #589763

Niels Harland

Hi Vincenzo,

I've just tried it on a brand new, never used before laptop, with a Dutch browser and still got redirected to the language in the lang.php file, instead of the Dutch version of the website.

March 30, 2015 at 11:50 am #590429

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+01:00)

Hello Niels,
I tried today from my Firefox browser that I set up with Dutch as first language, Spanish as a secondary, Italian as third language and English as Fourth.

At first I started seeing the uk URL, but then it immediately redirected to the Dutch page ( /de/)

Can you please confirm?

The topic ‘[Closed] Directly redirect to language specific homepage’ is closed to new replies.