realUrl not writing preVar for default language

社会主义新天地 提交于 2020-01-23 11:41:14

问题


I am running realURL 1.12.6 on TYPO3 4.5.26

I am used to realURL creating paths that contain the preVar also for the default language, like www.example.com/de/seite/ and www.example.com/en/page/

In one case, this is just not happening - or I think, only sometimes. In most of the cases, I get www.example.com/seite/ and www.example.com/en/page/

Where can this be changed?

PS: Here's the beginning of my realurlconf:

$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
    'init' => array(
        'enableCHashCache' => 1,
        'appendMissingSlash' => 'ifNotFile',
        'enableUrlDecodeCache' => 1,
        'enableUrlEncodeCache' => 1,
        'respectSimulateStaticURLs' => 0,
        //'postVarSet_failureMode'=>'redirect_goodUpperDir',
    ),
'redirects_regex' => array (

),
'preVars' => array(
                     array(
                         'GETvar' => 'L',
                         'valueMap' => array(
                                            'de' => '0',
                                            'en' => '1',
                                    ),
                         'valueDefault' => 'de',
                         'noMatch' => 'bypass',
                    ),
                    array(
                            'GETvar' => 'no_cache',
                            'valueMap' => array(
                                'no_cache' => 1,
                            ),
                            'noMatch' => 'bypass',
                    ),


            ),

回答1:


If I use this configuration (valueDefault is set, noMatch not) then 404 error page is not triggered when calling urls like www.domain.com/notexisting/someexistingpage/ or www.domain.com/notexisting/

The 404 page is only triggered when calling urls like www.domain.com/notexisting/alsonotexistingpage/

That means, realurl expects the first part of the url to be the language part (here: "notexisting") and if realurl can't map this key, it uses the "valueDefault". But I want the 404 to be triggered, how can I achieve this?

Edit: I've the solution now:

realurl config:

'GETvar' => 'L',
'valueMap' => array(
    'en' => '0',
    'de' => '1',
),
'noMatch' => 'bypass',

TypoScript config:

config.defaultGetVars.L  = 0
config.linkVars = L



回答2:


Remove 'noMatch' => 'bypass', from your preVar configuration. The GET-Parameter "L" is not set to "0" if you open "www.example.com", so then the noMatch just bypasses the preVar configuration. If you only set valueDefault, it should work fine.



来源:https://stackoverflow.com/questions/17109737/realurl-not-writing-prevar-for-default-language

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!