# Weird problem with custom language url's

**URL:** <https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 13, 2020, 3:22pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788 "2020-07-13T15:22:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![samzzi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/samzzi/32/11195_2.png) [@samzzi](https://forum.getkirby.com/u/samzzi)\
**Post date:** [July 13, 2020, 3:22pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/1 "2020-07-13T15:22:06Z")

</div>

Hi,

I’m having this weird problem with multi language url’s (so [sitename.com](http://sitename.com) vs sitename.be for example). Kirby always loads the default url no matter what I set up in the config or language files. Although on my localhost it works perfectly.

So when i visit sitename.be the url in the browser is sitename.be but Kirby detects it as [sitename.com](http://sitename.com) when I use url() and the $kirby-\>language() still gives the language from [sitename.com](http://sitename.com) instead of sitename.be.

I would think it has to do with the way the url gets passed in nginx but I also have laravel sites with a simular setup who don’t have any problem so it’s a combined kirby/forge problem, not sure.

I’m using forge on linode (nginx + php-fpm) There wouldn’t be anybody with a simular problem wo would have an idea?

Cheers,  
Sam

---

<div class="post-metadata">

**Author:** ![samzzi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/samzzi/32/11195_2.png) [@samzzi](https://forum.getkirby.com/u/samzzi)\
**Post date:** [July 13, 2020, 3:31pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/2 "2020-07-13T15:31:31Z")

</div>

If I do an echo of Server::get(‘HTTP\_HOST’) it comes out correctly, so it has to be deeper into Kirby that something goes wrong 🤔

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [July 13, 2020, 3:47pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/3 "2020-07-13T15:47:22Z")

</div>

What is your Kirby version and is language detection enabled or not?

---

<div class="post-metadata">

**Author:** ![samzzi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/samzzi/32/11195_2.png) [@samzzi](https://forum.getkirby.com/u/samzzi)\
**Post date:** [July 13, 2020, 3:52pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/4 "2020-07-13T15:52:42Z")

</div>

3.4, language detection is disabled. Here’s a screen from some debugging.  
Still in doubt if I’m being an idiot and missing something easy or there’s really something funky going on here 😬

 ![CleanShot 2020-07-13 at 17.47.42](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/1/1569765f0a19ce64ff6e7a427ad681ed63371b74.jpeg)

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [July 13, 2020, 4:45pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/5 "2020-07-13T16:45:01Z")

</div>

Could you please post your config file or files (if you are using multiple) and your language files?

---

<div class="post-metadata">

**Author:** ![samzzi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/samzzi/32/11195_2.png) [@samzzi](https://forum.getkirby.com/u/samzzi)\
**Post date:** [July 13, 2020, 5:04pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/6 "2020-07-13T17:04:10Z")

</div>

Sure mate. (and tx for taking the time to take a look)

**config.php**

```auto
<?php

return [
    'debug' => true,

    'languages' => true,

    'urls' => [
        'nl' => 'http://mijngeldenik.int',
        'fr' => 'http://financesetmoi.int',
    ],

    'placeholders' => [
        'year' => date('Y'),
    ],

    'panel.install' => true,

    'omz13.xmlsitemap' => [
        'cacheTTL' => 60,
        'includeUnlistedWhenSlugIs' => [],
        'includeUnlistedWhenTemplateIs' => ['blog', 'blog-post'],
        'excludePageWhenTemplateIs' => ['block-centered-content', 'block-comp-content', 'block-hero', 'block-table'],
        'excludePageWhenSlugIs' => [],
        'excludeChildrenWhenTemplateIs' => ['block-centered-content', 'block-comp-content', 'block-hero', 'block-table'],
        'disableImages' => false,
    ],

    'block' => [

        'background' => [
            'default' => '',
            'primary' => 'bgc--primary-1',
            'secondary' => 'bgc--secondary-1',
        ],

        'position' => [
            'normal' => '',
            'alt' => 'type-alt',
        ],

        'navigato-navigate' => [
            'class' => 'trigger--navigato-navigate',
        ],
        
    ],

    'date' => [
        'handler' => 'strftime'
    ],

    'bnomei.robots-txt.content' => null,
    'bnomei.robots-txt.sitemap' => null,
    'bnomei.robots-txt.groups' => [
        '*' => [
            'disallow' => [
                '/kirby/',
                '/site/',
            ],
            'allow' => [
                '/media/',
            ]
        ]
    ]
];

```

**config.mijngeldenik.xxxx.be.php**

```auto
<?php

return [

    'debug' => false,

    'urls' => [
        'nl' => 'https://mijngeldenik.xxxx.be',
        'fr' => 'https://financesetmoi.xxxx.be',
    ],
];

```

**config.financesetmoi.xxxx.be.php**

```auto
<?php

return [

    'debug' => false,

    'urls' => [
        'nl' => 'https://mijngeldenik.xxxx.be',
        'fr' => 'https://financesetmoi.xxxx.be',
    ],

];

```

**nl.php**

```auto
<?php

return [
    'code' => 'nl',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'nl_BE'
    ],
    'name' => 'Nederlands',
    'translations' => [
        'header.back_to_home' => 'Terug naar de homepagina',
        'header.mobile.back_to_home' => 'Homepage',
    ],
    
    'url' => option('urls.nl'),
];

```

**fr.php**

```auto
<?php

return [
    'code' => 'fr',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'fr_FR'
    ],
    'name' => 'Français',
    'translations' => [
        'header.back_to_home' => 'Retour à l\'accueil',
        'header.mobile.back_to_home' => 'Homepage',
    ],
    
    'url' => option('urls.fr'),
];

```

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [July 13, 2020, 5:52pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/7 "2020-07-13T17:52:01Z")

</div>

Hm, that looks all good to me.

Is this a new issue with 3.4 that you did not encounter with the previous version?

---

<div class="post-metadata">

**Author:** ![samzzi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/samzzi/32/11195_2.png) [@samzzi](https://forum.getkirby.com/u/samzzi)\
**Post date:** [July 13, 2020, 6:13pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/8 "2020-07-13T18:13:19Z")

</div>

Quite puzzled myself also… This is the first time I use this ‘feature’. I’ve only worked with /nl /fr etc… in previous versions. Weird thing is that it does work on my localhost (the .int domains) so I honestly have no clue what the problem could be since the `Server::get('http_host')` comes through correctly.

---

<div class="post-metadata">

**Author:** ![samzzi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/samzzi/32/11195_2.png) [@samzzi](https://forum.getkirby.com/u/samzzi)\
**Post date:** [July 13, 2020, 7:58pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/9 "2020-07-13T19:58:21Z")

</div>

I already have found a temporary solution. As suspected the problem is a combination of Kirby and nginx.

If I create a seperate vhost for the other language instead of an alias then it works … Not sure why this is though. (other (as in laravel,…) sites don’t have this problem)

**This was the configuration before the temporary solution. (with both domains as a server\_name)**

```auto
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name mijngeldenik.xxxx.be financesetmoi.xxxx.be;
    server_tokens off;
    root /home/forge/mijngeldenik.xxxx.be/;

    ssl_certificate /etc/nginx/ssl/mijngeldenik.xxxx.be/847563/server.crt;
    ssl_certificate_key /etc/nginx/ssl/mijngeldenik.xxxx.be/847563/server.key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    access_log off;
    error_log /var/log/nginx/mijngeldenik.xxxx.be-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

```

**This is the configuration after the temporary solution (seperate host per domain)**

```auto
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/mijngeldenik.xxxx.be/before/*;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name mijngeldenik.xxxx.be;
    server_tokens off;
    root /home/forge/mijngeldenik.xxxx.be/;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/mijngeldenik.xxxx.be/server/*;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    access_log off;
    error_log /var/log/nginx/mijngeldenik.xxxx.be-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name financesetmoi.xxxx.be;
    server_tokens off;
    root /home/forge/mijngeldenik.xxxx.be/;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    access_log off;
    error_log /var/log/nginx/mijngeldenik.xxxx.be-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

```

#forge #nginx #kirby-3 #linode #ubuntu

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [July 13, 2020, 8:01pm UTC](https://forum.getkirby.com/t/weird-problem-with-custom-language-urls/18788/10 "2020-07-13T20:01:59Z")

</div>

That would have been my next question…
