虽然我已安装了realurl并且我能够使用各自的语音URL路径段访问TYPO3中的页面,但前端(即TMENU中)中自动生成的链接仍然指向https://example.com/index.php?id=123
而不是https://example.com/page-name
。
我知道扩展程序手册https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#my-urls-still-look-like-indexphpid12345-whats-the-problem中的常见问题解答部分,但建议添加
的解决方案config.tx_realurl_enable = 1
到模板没有解决问题。
我在常规设置中有多语言设置,因此参数L
可以使用该语言。它也适用于手动调用正确的地址(即https://example.com/en/page-name
)。
以下是我的设置的相关部分:
realurl扩展设置为手动配置。这是相应的配置文件:
<?php
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'postVarSet_failureMode' => '',
),
'redirects' => array(),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'L',
'valueMap' => array(
'en' => '1',
),
'valueDefault' => 'en',
'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,
'firstHitPathCache' => 1,
),
'fixedPostVars' => array(),
'postVarSets' => array(
'_DEFAULT' => array(
// news archive parameters
'archive' => array(
array(
'GETvar' => 'tx_ttnews[year]' ,
),
array(
'GETvar' => 'tx_ttnews[month]' ,
'valueMap' => array(
'january' => '01',
'february' => '02',
'march' => '03',
'april' => '04',
'may' => '05',
'june' => '06',
'july' => '07',
'august' => '08',
'september' => '09',
'october' => '10',
'november' => '11',
'december' => '12',
),
),
),
// news pagebrowser
'browse' => array(
array(
'GETvar' => 'tx_ttnews[pointer]',
),
),
// news categories
'select_category' => array (
array(
'GETvar' => 'tx_ttnews[cat]',
),
),
// news articles and searchwords
'article' => array(
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' => '-',
),
),
),
array(
'GETvar' => 'tx_ttnews[backPid]',
),
array(
'GETvar' => 'tx_ttnews[swords]',
),
),
),
),
// configure filenames for different pagetypes
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 1,
'index' => array(
'print.html' => array(
'keyValues' => array(
'type' => 98,
),
),
'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,
),
),
),
),
),
);
?>
CONSTANTS模板的一部分:
mod.SHARED {
defaultLanguageFlag = de.gif
defaultLanguageLabel = Deutsch
}
# Define some vars for use later on
baseURL = https://example.com/
german = 0
english = 1
# real URL config
config.baseURL = {$baseURL}
config.absRefPrefix = {$baseURL}
config.simulateStaticDocuments = 0
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
config.linkVars = L
config.prefixLocalAnchors = all
plugin {
tx_srstaticinfo.languageCode = DE
tx_srlanguagemenu {
showInactive = 1
showCurrent = 1
useSelfLanguageTitle = 1
languagesUidsList = 0,1
defaultLanguageISOCode = DE
defaultCountryISOCode = DE
}
}
SETUP部分(此处仅显示配置和菜单部分):
config.baseURL = {$baseURL}
### Configuration
## menu
lib.menu = HMENU
lib.menu.1 = TMENU
lib.menu.1 {
NO.allWrap = <li>|</li>
ACT = 1
ACT.wrapItemAndSub = <li class="ACT">|</li>
wrap = <ul class="menu">|</ul>
}
## language menu
plugin.tx_srlanguagemenu.settings {
useSysLanguageTitle = 0
defaultLanguageISOCode = DE
LanguageISOCode = DE
link.NO.stdWrap = |
hideIfNoAltLanguages = 1
#outputs a list (2: list, 1: selection list, 0:flag)
defaultLayout = 0
links.stdWrap.split.wrap >
_CSS_DEFAULT_STYLE >
}
# Building the page
# Default PAGE object:
page = PAGE
# Define the template
page.10 = TEMPLATE
# Our template is a file
page.10.template = FILE
page.10.template.file = fileadmin/template/index.html
# Insert stylesheet in the head of the website
page.stylesheet = {$baseURL}fileadmin/template/style.css
# Work with the subpart "DOCUMENT"
page.10.workOnSubpart = DOCUMENT
# Define the subparts, which are inside the subpart DOCUMENT
page.10.subparts {
# The subpart LANGMENU outputs a language selection widget
LANGMENU = HMENU
LANGMENU < plugin.tx_srlanguagemenu.widgets.menu
# The subpart CONTENTLEFT outputs the content of the left column
CONTENTLEFT = CONTENT
# Display the menu
CONTENTLEFT < lib.menu
[...]
}
[...]
# Setting up the language variable "L" to be passed along with links
config.linkVars = L
#values for default language
config.sys_language_uid = 0
config.language = de
config.locale_all = de_DE
# English language, sys_language.uid = 1
[globalVar = GP:L = {$english}]
config.sys_language_uid = 1
config.language = en
config.locale_all = en_GB
[global]
答案 0 :(得分:1)
config.tx_realurl_enable = 1
必须位于SETUP部分,而不是模板的CONSTANTS部分。
实际上所有配置配置都必须在SETUP中。常量仅用作设置中的占位符,因此您可以使用预定义常量(包含在默认TS或某些扩展TS中)或自己定义它们并在您的设置中添加引用{$ constantName}。
config.simulateStaticDocuments = 0
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
config.linkVars = L
config.prefixLocalAnchors = all