TYPO3 - indexed_search 生成错误的 URL 结果
TYPO3 - indexed_search generates wrong URL's in result
我在前端使用 indexed_search,因此用户可以在我的页面上搜索,例如搜索新闻。
但是搜索结果中的URL是错误的!
例如
预期 URL:
http://my-page.com/de/neuigkeiten/produktneuheiten/detail/neue-nachricht.html
结果URL:
http://my-page.com/de/neuigkeiten/produktneuheiten/detail/detail/News/neue-nachricht.html
您可以从结果 URL 中看到 /detail/News
被渲染到 URL。
页面结构如下所示:
问题:
- 为什么
/detail/News
出现在URL中?
- 我该如何解决?
如果您需要我提供任何信息,请告诉我。
typo3conf/realurl_conf.php
<?php
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',tx_realurl_pathsegment';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
'_DEFAULT' => array (
'init' => array (
'enableCHashCache' => '1',
'appendMissingSlash' => 'ifNotFile,redirect',
'enableUrlDecodeCache' => '1',
'enableUrlEncodeCache' => '1',
'emptyUrlReturnValue' => '/',
'postVarSet_failureMode' => ''
//'postVarSet_failureMode' => 'redirect_goodUpperDir'
),
'redirects' => array(
'de.html'=>'de/',
'en.html'=>'en/',
'fr.html'=>'fr/',
'es.html'=>'es/',
),
'preVars' => array (
array (
'GETvar' => 'no_cache',
'valueMap' => array (
'nc' => '1',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
'fr' => '2',
'es' => '3',
),
'valueDefault' => 'de',
),
array (
'GETvar' => 'lang',
'valueMap' => array (
'de' => 'de',
'en' => 'en',
'fr' => 'fr',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '7',
'firstHitPathCache' => 1,
'rootpage_id' => '1',
),
'fixedPostVars' => array (
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),
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,
)
)
),
'newsCategoryConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
'newsTagConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
'154' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
'155' => 'newsDetailConfiguration',
'156' => 'newsDetailConfiguration',
'157' => 'newsDetailConfiguration',
'399' => 'newsDetailConfiguration',
'71' => 'newsTagConfiguration',
'72' => 'newsCategoryConfiguration',
),
'postVarSets' => array (
'_DEFAULT' => array(
'productfinder' => array(
array(
'GETvar' => 'tx_mbclpdb_mbclproductfinder[controller]',
'noMatch' => 'bypass'
)
),
'filelist' => array(
array(
'GETvar' => 'tx_mbdownloads_mbfilelist[controller]',
'GETvar' => 'tx_mbdownloads_mbfilelistmarginal[controller]',
),
array(
'GETvar' => 'tx_mbdownloads_mbfilelist[action]',
'GETvar' => 'tx_mbdownloads_mbfilelistmarginal[action]',
'noMatch' => 'bypass'
),
),
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass'
)
),
'dateFilter' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
),
),
'page' => array(
array(
'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
),
),
),
),
'fileName' => array (
//
// if you don't want .html-URLs set the following to "false" (e.g. 'defaultToHTMLsuffixOnPrev' => false,)
// then you get http://www.yourdomain.com/imprint/ instead of http://www.yourdomain.com/imprint.html
//
'defaultToHTMLsuffixOnPrev' => true,
'index' => array (
'sitemap.xml' => array (
'keyValues' => array(
'type' => 776,
)
),
'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',
),
),
'news.rss' => array (
'keyValues' => array (
'type' => '9818',
),
),
'products.rss' => array (
'keyValues' => array (
'type' => '9819',
),
),
'events.rss' => array (
'keyValues' => array (
'type' => '9820',
),
),
'workshops.rss' => array (
'keyValues' => array (
'type' => '9821',
),
),
'news.json' => array (
'keyValues' => array (
'type' => '9898',
),
),
),
),
),
);
?>
我能够通过从文件中删除这两个数组来解决它typo3conf/realurl_conf.php
:
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),
我在前端使用 indexed_search,因此用户可以在我的页面上搜索,例如搜索新闻。
但是搜索结果中的URL是错误的!
例如
预期 URL:
http://my-page.com/de/neuigkeiten/produktneuheiten/detail/neue-nachricht.html
结果URL:
http://my-page.com/de/neuigkeiten/produktneuheiten/detail/detail/News/neue-nachricht.html
您可以从结果 URL 中看到 /detail/News
被渲染到 URL。
页面结构如下所示:
问题:
- 为什么
/detail/News
出现在URL中? - 我该如何解决?
如果您需要我提供任何信息,请告诉我。
typo3conf/realurl_conf.php
<?php
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',tx_realurl_pathsegment';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
'_DEFAULT' => array (
'init' => array (
'enableCHashCache' => '1',
'appendMissingSlash' => 'ifNotFile,redirect',
'enableUrlDecodeCache' => '1',
'enableUrlEncodeCache' => '1',
'emptyUrlReturnValue' => '/',
'postVarSet_failureMode' => ''
//'postVarSet_failureMode' => 'redirect_goodUpperDir'
),
'redirects' => array(
'de.html'=>'de/',
'en.html'=>'en/',
'fr.html'=>'fr/',
'es.html'=>'es/',
),
'preVars' => array (
array (
'GETvar' => 'no_cache',
'valueMap' => array (
'nc' => '1',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
'fr' => '2',
'es' => '3',
),
'valueDefault' => 'de',
),
array (
'GETvar' => 'lang',
'valueMap' => array (
'de' => 'de',
'en' => 'en',
'fr' => 'fr',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '7',
'firstHitPathCache' => 1,
'rootpage_id' => '1',
),
'fixedPostVars' => array (
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),
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,
)
)
),
'newsCategoryConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
'newsTagConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
)
)
)
),
'154' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
'155' => 'newsDetailConfiguration',
'156' => 'newsDetailConfiguration',
'157' => 'newsDetailConfiguration',
'399' => 'newsDetailConfiguration',
'71' => 'newsTagConfiguration',
'72' => 'newsCategoryConfiguration',
),
'postVarSets' => array (
'_DEFAULT' => array(
'productfinder' => array(
array(
'GETvar' => 'tx_mbclpdb_mbclproductfinder[controller]',
'noMatch' => 'bypass'
)
),
'filelist' => array(
array(
'GETvar' => 'tx_mbdownloads_mbfilelist[controller]',
'GETvar' => 'tx_mbdownloads_mbfilelistmarginal[controller]',
),
array(
'GETvar' => 'tx_mbdownloads_mbfilelist[action]',
'GETvar' => 'tx_mbdownloads_mbfilelistmarginal[action]',
'noMatch' => 'bypass'
),
),
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass'
)
),
'dateFilter' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
),
),
'page' => array(
array(
'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
),
),
),
),
'fileName' => array (
//
// if you don't want .html-URLs set the following to "false" (e.g. 'defaultToHTMLsuffixOnPrev' => false,)
// then you get http://www.yourdomain.com/imprint/ instead of http://www.yourdomain.com/imprint.html
//
'defaultToHTMLsuffixOnPrev' => true,
'index' => array (
'sitemap.xml' => array (
'keyValues' => array(
'type' => 776,
)
),
'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',
),
),
'news.rss' => array (
'keyValues' => array (
'type' => '9818',
),
),
'products.rss' => array (
'keyValues' => array (
'type' => '9819',
),
),
'events.rss' => array (
'keyValues' => array (
'type' => '9820',
),
),
'workshops.rss' => array (
'keyValues' => array (
'type' => '9821',
),
),
'news.json' => array (
'keyValues' => array (
'type' => '9898',
),
),
),
),
),
);
?>
我能够通过从文件中删除这两个数组来解决它typo3conf/realurl_conf.php
:
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass'
),