我正在使用RealURL 1.12.8和新闻(tx_news)3.0.1来运行Typo3 6.2.4。使用RealURL的自动配置会重写“普通”页面的URL,但不会重写新闻的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
),
),
),
);
答案 0 :(得分: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