简体   繁体   English

realUrl没有为默认语言编写preVar

[英]realUrl not writing preVar for default language

I am running realURL 1.12.6 on TYPO3 4.5.26 我在TYPO3 4.5.26上运行realURL 1.12.6

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/ 我习惯于使用realURL创建包含preVar的路径,也可以使用默认语言,例如www.example.com/de/seite/和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/ 在大多数情况下,我会访问www.example.com/seite/和www.example.com/en/page/

Where can this be changed? 哪里可以改变?

PS: Here's the beginning of my realurlconf: PS:这是我的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',
                    ),


            ),

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/ 如果我使用此配置(设置了valueDefault,noMatch not),则在调用www.domain.com/notexisting/someexistingpage/或www.domain.com/notexisting/等网址时不会触发404错误页面

The 404 page is only triggered when calling urls like www.domain.com/notexisting/alsonotexistingpage/ 只有在调用www.domain.com/notexisting/alsonotexistingpage/等网址时才会触发404页面

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". 这意味着,realurl期望url的第一部分是语言部分(此处:“notexisting”),如果realurl无法映射此键,则使用“valueDefault”。 But I want the 404 to be triggered, how can I achieve this? 但我想要触发404,我该怎么做呢?

Edit: I've the solution now: 编辑:我现在有解决方案:

realurl config: realurl配置:

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

TypoScript config: TypoScript配置:

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

Remove 'noMatch' => 'bypass', from your preVar configuration. 从preVar配置中删除'noMatch' => 'bypass', The GET-Parameter "L" is not set to "0" if you open "www.example.com", so then the noMatch just bypasses the preVar configuration. 如果打开“www.example.com”,GET参数“L”不会设置为“0”,因此noMatch只会绕过preVar配置。 If you only set valueDefault, it should work fine. 如果你只设置valueDefault,它应该可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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