简体   繁体   中英

Rewrite default language URL

I just have setup a typo3 website. Page is running well. But got some error. My Onpage optimization everytime gives me a bad feedback because of the default language tag.

www.mywebsite.com/contact/

and

www.mywebsite.com/contact/?L=0

When I try to redirect it well, with a permanent moved 301 redirect, it creates a loop and I can´t redirect his well.

I tried to redirect it with my_redirects extension and also with htacess, but I got just a bad result.

Lets say your default language is en and your secondary language is es then try this snippet in your <typo3root>/typoconf/realurl_conf.php .

    'preVars' => array (
        0 => array (
            'GETvar' => 'L',
            'valueMap' => array (
                'es' => '1',
            ),
            'noMatch' => 'bypass',
        ),
    ),

I think your missing the 'noMatch' => 'bypass', it allows the L parameter to be absent.

This will result in:

  • English / default URL: www.mywebsite.com/contact/
  • Spanish URL: www.mywebsite.com/es/contacto/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM