本文介绍了realUrl不为默认语言编写preVar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在TYPO3 4.5.26上运行realURL 1.12.6

I am running realURL 1.12.6 on TYPO3 4.5.26

我习惯于realURL创建也包含默认语言preVar的路径,例如www.example.com/de/seite/和www.example.com/en/page/

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/

在一种情况下,这只是没有发生-或者我认为,只是在某些时候.在大多数情况下,我会看到www.example.com/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/

在哪里可以更改?

PS:这是我的realurlconf的开头:

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',
                    ),


            ),

推荐答案

如果我使用此配置(设置了valueDefault,则不设置noMatch),则在调用url之类的内容时不会触发404错误页面www.domain.com/notexisting/someexistingpage/或者www.domain.com/notexisting/

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

仅在调用url之类的内容时触发404页面www.domain.com/notexisting/alsonotexistingpage/

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

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

我现在有解决方案:

realurl配置:

realurl config:

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

TypoScript配置:

TypoScript config:

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

这篇关于realUrl不为默认语言编写preVar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:44