TYPO3 realURL无法生成中文URL
TYPO3 realURL can't generate chinese URL
我的TYPO3中有中文内容需要生成URLs,
中文内容和生成的URL为空:
我的中文 ID = 8。
如果没有 RealURL 我会显示我的页面,但是 URL :
http://localhost/zh/locations-chinese/?tx_locations_locationsfe%5Blocation%5D=104&tx_locations_locationsfe%5BmyId%5D=104&tx_locations_locationsfe%5Baction%5D=list&tx_locations_locationsfe%5Bcontroller%5D=Location&cHash=b864e25ff5fba24b2e44ce0723265881
这就是我需要生成的内容:
http://localhost/locations/berlin.html?L=8&cHash=32a89be23eb7dc2516893bdf0e1cc424
或
http://localhost/locations/柏林.html?L=8&cHash=32a89be23eb7dc2516893bdf0e1cc424
这是我得到的:
http://localhost/locations.html?L=8&cHash=32a89be23eb7dc2516893bdf0e1cc424
错误:
Page Not Found
Reason: Request parameters could not be validated (&cHash comparison
failed)
那是我的 /typo3cong/realurl_conf。php
<?php
$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
//'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'postVarSet_failureMode' => '',
'EnableAllUnicodeLetters' => true,
'doNotRawUrlEncodeParameterNames' => true,
),
'redirects' => array(),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'languageExceptionUids' => '8',
'expireDays' => 7,
'rootpage_id' => 1,
'firstHitPathCache' => 1,
),
'fixedPostVars' => array(
162 => array(
array(
'GETvar' => 'tx_locations_locationsfe[controller]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[action]',
'valueMap' => array(
//'detail' => 'list',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[location]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[myId]',
'lookUpTable' => array(
'table' => 'tx_locations_domain_model_location',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
// language support (translated urls)
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
163 => array(
array(
'GETvar' => 'tx_locations_locationsfe[controller]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[action]',
'valueMap' => array(
//'detail' => 'listprice',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[location]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[myId]',
'lookUpTable' => array(
'table' => 'tx_locations_domain_model_location',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
// language support (translated urls)
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
),
'postVarSets' => array(
'_DEFAULT' => array (),
),
// configure filenames for different pagetypes
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 1,
'index' => array(
'print.html' => array(
'keyValues' => array(
'type' => 98,
),
),
'sitemap.xml' => array(
'keyValues' => array(
'type' => 200,
),
),
'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,
),
),
),
),
),
);
?>
一个URL只能由ASCII字符和"cannot" include/understand Unicode字符组成,例如UTF-8。您需要使用所谓的 "percent encoding" 编码(或替换)任何 Unicode 字符(中文)。
据我所知,您的配置中有错字。
它应该读作小写 'enableAllUnicodeLetters' => true
Unicode 字符 url 自动编码。
我的TYPO3中有中文内容需要生成URLs, 中文内容和生成的URL为空: 我的中文 ID = 8。 如果没有 RealURL 我会显示我的页面,但是 URL :
http://localhost/zh/locations-chinese/?tx_locations_locationsfe%5Blocation%5D=104&tx_locations_locationsfe%5BmyId%5D=104&tx_locations_locationsfe%5Baction%5D=list&tx_locations_locationsfe%5Bcontroller%5D=Location&cHash=b864e25ff5fba24b2e44ce0723265881
这就是我需要生成的内容:
http://localhost/locations/berlin.html?L=8&cHash=32a89be23eb7dc2516893bdf0e1cc424
或
http://localhost/locations/柏林.html?L=8&cHash=32a89be23eb7dc2516893bdf0e1cc424
这是我得到的:
http://localhost/locations.html?L=8&cHash=32a89be23eb7dc2516893bdf0e1cc424
错误:
Page Not Found
Reason: Request parameters could not be validated (&cHash comparison failed)
那是我的 /typo3cong/realurl_conf。php
<?php
$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
//'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'postVarSet_failureMode' => '',
'EnableAllUnicodeLetters' => true,
'doNotRawUrlEncodeParameterNames' => true,
),
'redirects' => array(),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'languageExceptionUids' => '8',
'expireDays' => 7,
'rootpage_id' => 1,
'firstHitPathCache' => 1,
),
'fixedPostVars' => array(
162 => array(
array(
'GETvar' => 'tx_locations_locationsfe[controller]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[action]',
'valueMap' => array(
//'detail' => 'list',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[location]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[myId]',
'lookUpTable' => array(
'table' => 'tx_locations_domain_model_location',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
// language support (translated urls)
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
163 => array(
array(
'GETvar' => 'tx_locations_locationsfe[controller]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[action]',
'valueMap' => array(
//'detail' => 'listprice',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[location]',
'valueMap' => array(
//'action' => 'detail',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_locations_locationsfe[myId]',
'lookUpTable' => array(
'table' => 'tx_locations_domain_model_location',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
// language support (translated urls)
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
),
'postVarSets' => array(
'_DEFAULT' => array (),
),
// configure filenames for different pagetypes
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 1,
'index' => array(
'print.html' => array(
'keyValues' => array(
'type' => 98,
),
),
'sitemap.xml' => array(
'keyValues' => array(
'type' => 200,
),
),
'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,
),
),
),
),
),
);
?>
一个URL只能由ASCII字符和"cannot" include/understand Unicode字符组成,例如UTF-8。您需要使用所谓的 "percent encoding" 编码(或替换)任何 Unicode 字符(中文)。
据我所知,您的配置中有错字。
它应该读作小写 'enableAllUnicodeLetters' => true
Unicode 字符 url 自动编码。