0

我正在使用 RealURL 1.12.8 和 News (tx_news) 3.0.1 运行 Typo3 6.2.4。使用来自 RealURL 的自动配置会重写“普通”页面的 URL,但不会重写新闻。生成的链接如下所示:

index.php?id=5&tx_news_pi1%5Bnews%5D=4&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=706379a0ef43d4020448c5193f865bf1

这就是自动配置给我的。我刚刚插入了来自http://docs.typo3.org/typo3cms/extensions/news/Main/Administration/Realurl/Index.html的部分。目前我对创建一种特殊的重写 URL 不感兴趣,我只想让 RealURL 重写新闻 URL。一旦运行,我想我会弄清楚其余的。

<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
  '_DEFAULT' => 
  array (
    'init' => 
    array (
      'enableCHashCache' => true,
      'appendMissingSlash' => 'ifNotFile,redirect',
      'adminJumpToBackend' => true,
      'enableUrlDecodeCache' => true,
      'enableUrlEncodeCache' => true,
      'emptyUrlReturnValue' => '/',
    ),
    'pagePath' => 
    array (
      'type' => 'user',
      'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
      'spaceCharacter' => '-',
      'languageGetVar' => 'L',
      'rootpage_id' => '1',
    ),
    'fileName' => 
    array (
      'defaultToHTMLsuffixOnPrev' => 0,
      'acceptHTMLsuffix' => 1,
      'index' => 
      array (
        'print' => 
        array (
          'keyValues' => 
          array (
            'type' => 98,
          ),
        ),
      ),
    ),
    'postVarSets' => 
    array (
      '_DEFAULT' => 
      array (
// EXT:news start
'news' => array(
        array(
                'GETvar' => 'tx_news_pi1[action]',
        ),
        array(
                'GETvar' => 'tx_news_pi1[controller]',
        ),
        array(
                'GETvar' => 'tx_news_pi1[news]',
                'lookUpTable' => array(
                        'table' => 'tx_news_domain_model_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' => 'l10n_parent',
                        'autoUpdate' => 1,
                        'expireDays' => 180,
                ),
        ),
),
// EXT:news end
      ),
    ),
  ),
);
4

1 回答 1

0

事实证明,我realurl_conf.php是正确的,但是缺少 TypoScript 配置部分。一旦我将这些行放入我的根页面的模板设置中,Typo3 就开始重写 URL:

config.absRefPrefix = /
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
# dont forget to set the allowed range - otherwise anything else could be inserted
config.linkVars = L(0-3)

资源:

http://wiki.typo3.org/Realurl/manual#TypoScript_configuration http://docs.typo3.org/typo3cms/extensions/realurl/Realurl/Configuration/HandlingRelativeLinksWithSpeakingUrls/Index.html

于 2014-08-20T09:34:45.780 回答