Jump to content

How to avoid the 301/redirection on the default language ?


Doc
 Share

Recommended Posts

Hello (again),

My project is a multilanguage one.

On the homepage, I have a header menu where I display link of features, example :

<?php 
    $lg = $session->lg;
    echo $page->localHttpUrl("$lg").'dashboard'?>
?>

My website displays french by default.

The homepage is : www.website.com/ (in french default language)

The link in the code above is rendered as : www.website.com/dashboard

When I click on this link, it does a 301 -> www.website.com/fr/dashboard

dashboard is a child page of the homepage.

When I does the same in a non default language, such as 'en' / english for example, it doesn't do that 301 because the generated link in my code is www.website.com/en/dashboard

I know there is an option in the core module LanguageSupportPageName to prefix the page of the default language by 'fr' (in my case), but apparently it's not recommended.

"Choose Yes if you want the homepage of your default language to be served by the root URL / (recommended). Choose No if you want your root URL to perform a redirect to /name/ (where /name/ is the default language name of your homepage)."

Maybe it's not recommended because it's causing a 301 when you arrive the first time on the homepage (from / to /fr).

So how I could generate my link in the menu such as it displays www.website.com/fr ? I can do it by hacking some php of course, but perhaps there is a PW way to do it ?

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...