Redirect issues in multi-language setup


I’ve been using this method

to serve a page from my website for this domain

  • a keyword domain for some of my content.

After switching the site to multi language , however, some internal redirect causes the address bar to change to the ‘long URL’ you see now when going to the domain. How would I ideally avoid this?

I thought about doing a simple RewriteRule thing. Can I pass a slug - and language code - to Kirby’s index.php, so that it gets rendered with no redirects happening?

Thanks a lot!

What is the expected behavior. Which language variant do you want to show under the domain above?

I’d like to show the page currently displayed - which is German-only - but without the address bar changing.

And what is your default language?

Could you please post your language configuration, your config.php and what exactly you put into your index.php?

I can only test this locally with Valet and works as expected even in a multi-lang setting. But looks like you are using different domains per language?

Hello! Thanks for taking care of this!

My default language is English.

My config.php:


return [

	'debug' => true,

    'languages' => true,
	'languages.detect' => false,

	'omz13.xmlsitemap.cacheTTL' => 0,
	'omz13.xmlsitemap.disableImages' => true,
	'omz13.xmlsitemap.includeUnlistedWhenSlugIs' => ['home', 'talks', 'teaching', 'publications', 'contact', 'motivation', 'projects', 'press', 'projects'],
	'omz13.xmlsitemap.includeUnlistedWhenTemplateIs' => ['project', '', '', '' ],
	'omz13.xmlsitemap.excludePageWhenTemplateIs' => [ 'talk','publication','press_coverage' ],
	'omz13.xmlsitemap.excludePageWhenSlugIs' => [ 'form' ],
	'omz13.xmlsitemap.excludeChildrenWhenTemplateIs' => [ '' ],


Here is my complete index.php (covering several of those keyword domains):


require __DIR__ . '/kirby/bootstrap.php';

function domaincheck($domain) {

    $url = rtrim(strtolower((new Kirby)->request()->url()),"/");

    if (
        ($url == "http://localhost/$domain") || 
        ($url == "http://$domain") || 
        ($url == "https://$domain") || 
        ($url == "http://www.$domain") || 
        ($url == "https://www.$domain") 

    ) {
        return true;
    } else {
        return false;


if (domaincheck('')) {
	c::set('customtitle',"Experte für Digitalisierung");
    echo (new Kirby)->render('keyword-domains/experte-digitalisierung-de');

} elseif (domaincheck('')) {
	c::set('customtitle',"Experte für Innovation");
    echo (new Kirby)->render('keyword-domains/experte-innovation-de');

} elseif (domaincheck('')) {
	c::set('customtitle',"Keynote Speaker zum Thema »Digitalisierung«");
    echo (new Kirby)->render('keyword-domains/keynote-speaker-digitalisierung-de');

} elseif (domaincheck('')) {
	c::set('customtitle',"Keynote Speaker zum Thema »Innovation«");
    echo (new Kirby)->render('keyword-domains/keynote-speaker-innovation-de');

} elseif (domaincheck('')) {
	c::set('customtitle',"Redner zum Thema »Digitalisierung«");
    echo (new Kirby)->render('keyword-domains/redner-digitalisierung-net');

} elseif (domaincheck('')) {
	c::set('customtitle',"Redner zum Thema »Innovation«");
    echo (new Kirby)->render('keyword-domains/redner-innovation-org');

} elseif (domaincheck('')) {
	c::set('customtitle',"Vortrag »Innovation«");
    echo (new Kirby)->render('keyword-domains/vortrag-innovation-com');

} elseif (domaincheck('')) {
	c::set('customtitle',"Vortrag »Digitalisierung«");
    echo (new Kirby)->render('keyword-domains/vortrag-digitalisierung-com');

} elseif (domaincheck('')) {
	c::set('customtitle',"Vortrag »Kreativität«");
    echo (new Kirby)->render('keyword-domains/vortrag-kreativitaet-de');
} else {
    echo (new Kirby)->render();

Here is my language config:



return [
    'code' => 'de',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
    'name' => 'Deutsch',
    'url' => '',



return [
  'code' => 'en',
  'default' => true,
  'direction' => 'ltr',
  'locale' => 'en_US',
  'name' => 'English',
   'url' => ''

// 'url' => ''


The keyword domain subpages, like this one

(which I want to serve directly under the keyword domains) are in German language only, but I duplicated them to exist also in English (hard-coding a “de” lang-code into the header for those pages).

Again, thanks for your help!

Hm, yes, it always redirects to the default language domain in this case. I found that even if you don’t use different domains, the language code and page slug are added as path to the single-page domain, so obviously, language redirects kick in later and I have no idea how to prevent that.

I just tested just returning the page and this seems to work:

if ($_SERVER['SERVER_NAME'] === 'notes.delete.test' && $_SERVER['REQUEST_URI'] === '/' ) {
    echo page('somepage')->render();
} else {
    echo (new Kirby)->render();
1 Like

I see! Can I pass a slug and language code to index.php? I might be able to hack it into .htaccess then.

Did you see my last post?

(I hadn’t seen your last post, sorry!)

The above solution – using the page – works great! Thanks!