[TYPO3-english] RealURL force preVar

Michael Cannon michael at typo3vagabond.com
Fri Jan 13 18:44:08 CET 2012


Urs,

If you're using a custom realurl configuration, then you can use the
_DOMAINS encode/decode options to force your language.

Maybe it's not the cleanest, but works for some of what I need.

$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
    '_DEFAULT'              => $realurlConfig,
    'www.example.com'        => $realurlConfig,
    'www.example.fr' => $realurlConfig,
    'www.example.de'     => $realurlConfig,
);

$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DOMAINS'] = array(
    'encode' => array(
        array(
            'GETvar' => 'L',
            'value' => '0', // de
            'useConfiguration' => 'www.example.de',
            'urlPrepend' => 'http://www.example.de'
        ),
        array(
            'GETvar' => 'L',
            'value' => '1', // en
            'useConfiguration' => 'www.example.com',
            'urlPrepend' => 'http://www.example.com'
        ),
...
        array(
            'GETvar' => 'L',
            'value' => '3', // fr
            'useConfiguration' => 'www.example.fr',
            'urlPrepend' => 'http://www.example.com/fr/'
        ),
    ),
    'decode' => array(
        'www.example.com' => array(
            'GETvars' => array(
                'L' => '0',
            ),
            'useConfiguration' => 'www.example.de'
        ),
        'www.example.de' => array(
            'GETvars' => array(
                'L' => '1',
            ),
            'useConfiguration' => 'www.example.com'
        ),
        'www.example.fr' => array(
            'GETvars' => array(
                'L' => '3',
            ),
            'useConfiguration' => 'www.example.fr'
        ),
    )
);

Michael
--
Michael Cannon
The TYPO3 Vagabond <http://typo3vagabond.com> @ in2code.de
Been there, done that, 25 years of coding
Germany +49 (0)160 574 1973
US +1 617 539 6072
http://typo3vagabond.com





On Mon, Jan 9, 2012 at 11:04 PM, Urs Bräm <info at ursbraem.ch> wrote:

> Hi
>
> is it possible to make RealURL force the preVar language parameter to
> avoid duplicate content?
>
> My sites mostly should have a symmetrical URL structure for each language,
> like so:
>
> example.com/de/kontakt (L=0)
> example.com/fr/contact (L=1)
>
> not like so:
>
> example.com/kontakt (L=0)
> example.com/fr/contact (L=1)
>
> (as in the second example it would make the impression that the two
> languages don't have the same value, as german would be the main language
> and french a mere translation; a swiss political issue)
>
> This symmetrical URL structure is of course easy to achieve, but still
> Links in the form of example.com/kontakt *do work* and generate pages
> without the preVar in all the links. Is there a way to force TYPO3 to
> always maintain the preVar and force the default language into the URL if
> nothing is set??
>
> I'm not that concerned about DC, but I have had a few other problems
> resulting from confusions with the multiple URLs.
>
> Thanks!
> Urs
>
> PS here's my Config. I know "'noMatch' => 'bypass'" is usually not set,
> but I need it and turning it off wouldn't change anything regarding to a
> URL without preVar:
>
> <?php
> $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',
>                                                'fr' => '1',
>                                        ),
>                             'valueDefault' => 'de',
>                             'noMatch' => 'bypass',
>                        ),
>                      array(
>                                'GETvar' => 'no_cache',
>                                'valueMap' => array(
>                                    'no_cache' => 1,
>                                ),
>                                'noMatch' => 'bypass',
>                        ),
>                ),
>     'pagePath' => array(
>            'type' => 'user',
>            'userFunc' => 'EXT:realurl/class.tx_realurl_**
> advanced.php:&tx_realurl_**advanced->main',
>            'spaceCharacter' => '-',
>            'languageGetVar' => 'L',
>            'expireDays' => 7,
>            'rootpage_id' => 1,
>        ),
>
>
>         'postVarSets' => array(
>            '_DEFAULT' => array(
>                // news archive parameters
>                'date' => array(
>                    array(
>                        'GETvar' => 'tx_ttnews[month]' ,
>
>                        ),
>                    array(
>                        'GETvar' => 'tx_ttnews[year]' ,
>                        ),
>
>                    ),
>                // news pagebrowser
>                'browse' => array(
>                    array(
>                        'GETvar' => 'tx_ttnews[pointer]',
>                        ),
>                    ),
>                // news categories
>                'select_category' => array (
>                    array(
>                        'GETvar' => 'tx_ttnews[cat]',
>                        ),
>                    ),
>                // news articles and searchwords
>                'art' => array(
>                        array(
>                          'GETvar' => 'tx_ttnews[pointer]',
>                          'valueMap' => array(),
>                          'noMatch' => 'bypass',
>                        ),
>                        array(
>                          'GETvar' => 'tx_ttnews[tt_news]',
>                          'lookUpTable' => array(
>                            'table' => 'tt_news',
>                            'id_field' => 'uid',
>                            'alias_field' => 'title',
>                            'addWhereClause' => ' AND NOT deleted',
>                            'useUniqueCache' => 1,
>                            'useUniqueCache_conf' => array(
>                              'strtolower' => 1,
>                              'spaceCharacter' => '-',
>                            ),
>                            'languageGetVar' => 'L',
>                            'languageExceptionUids' => '',
>                            'languageField' => 'sys_language_uid',
>                            'transOrigPointerField' => 'l18n_parent',
>                            'autoUpdate' => 1,
>                            'expireDays' => 180,
>                          ),
>                        ),
>                      ),
>                ),
>            ),
>
>      'fileName' => array(
>            'defaultToHTMLsuffixOnPrev'=>**0,
>            'index' => array(
>                'rss.xml' => array(
>                    'keyValues' => array(
>                        'type' => 100,
>                    ),
>                ),
>                'rss091.xml' => array(
>                    'keyValues' => array(
>                        'type' => 101,
>                    ),
>                ),
>                'rdf.xml' => array(
>                    'keyValues' => array(
>                        'type' => 102,
>                    ),
>                ),
>                'atom.xml' => array(
>                    'keyValues' => array(
>                        'type' => 103,
>                    ),
>                ),
>            ),
>        ),
>  );
>  php?>
>
> --
> Urs Bräm
> macht Websites
> ---
> Certified Typo3 Integrator
> CH-3011 Bern
> www.ursbraem.ch
> ______________________________**_________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**english<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english>
>


More information about the TYPO3-english mailing list