Jump to content

[SOLVED] Force default home page

Recommended Posts

  • Angelino changed the title to Force default home page

I would have bought double-digit.com domain, and then for the dutch double-digit.com/nl. And also doubledigit.com with no hyphens that redirect to double-digit.com for SEO purposes. Or .be double-digit.be if the services and most customers is based in Belgium.

Link to comment
Share on other sites

Some answers from Google: https://developers.google.com/search/docs/specialty/international/managing-multi-regional-sites


Use different URLs for different language versions

Google recommends using different URLs for each language version of a page rather than using cookies or browser settings to adjust the content language on the page.

If you use different URLs for different languages, use hreflang annotations to help Google search results link to the correct language version of a page.

If you prefer to dynamically change content or reroute the user based on language settings, be aware that Google might not find and crawl all your variations. This is because the Googlebot crawler usually originates from the USA. In addition, the crawler sends HTTP requests without setting Accept-Language in the request header.


Link to comment
Share on other sites

In my page i have

<!doctype html>
<?php $label = 'label'; if ($user->language->name != 'default') { $label = "label{$user->language}";} ?>
<html lang='<?=$fields->get('label_languages')->$label;?>'>

so when i switch language the language is set to the correct one.

Link to comment
Share on other sites

I have also a dropdown switch


  $homepage = $pages->get( '/' );

  $langswitch = '';
  foreach ( $languages as $language ) {
    if ( !$page->viewable( $language ) ) continue; // is page viewable in this language?
    if ( $language->id == $user->language->id ) { // current user language
      $langswitch .= "<div class='current'>";
    } else {
      $langswitch .= "<div>";
    $url = $page->localUrl( $language );
    $hreflang = $homepage->getLanguageValue( $language, 'name' );
    $langswitch .= "<a hreflang='x-default' href='$url' title='{$language->title}'>{$language->title}<div class='{$language->name}'></div></a></div>";
  echo "<div class='dropdown'> 
         <div class='{$user->language->name}' title='Language'></div>
        <div class='language-switch-ph' style='display:none;'>{$langswitch}</div>


Link to comment
Share on other sites

First: define the matching /name/ for each language in your homepage


Second: Go to Modules > Core > Languages Support - Page Names > Settings and define the behaviour



This way the homepage will redirect to your specified default language /name/ if set.
It won't redirect from /nl/ or /es/ back to the default one.

In case you want to switch to another language as the default one - take a look here:

  • Like 5
Link to comment
Share on other sites

  • Angelino changed the title to [SOLVED] Force default home page

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...