首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有realurl的TYPO3 7.6.10 :可访问的页面,但前端的非静态链接

带有realurl的TYPO3 7.6.10 :可访问的页面,但前端的非静态链接
EN

Stack Overflow用户
提问于 2016-08-30 02:52:27
回答 1查看 359关注 0票数 0

尽管我已经安装了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中的常见问题部分,但是建议的解决方案是添加

代码语言:javascript
复制
config.tx_realurl_enable = 1

没有解决这个问题。

我在通常的设置中有一个多语言设置,以便参数L包含语言。当手动调用正确的地址(即https://example.com/en/page-name)时,它也会起作用。

以下是我的设置的相关部分:

realurl扩展被设置为手动配置。下面是相应的配置文件:

代码语言:javascript
复制
<?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,
                                    ),
                            ),
                    ),
            ),
    ),
);
?>

模板的常量部分:

代码语言:javascript
复制
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
  }
}

设置部分(此处仅显示配置和菜单部分):

代码语言:javascript
复制
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]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-30 17:14:19

代码语言:javascript
复制
config.tx_realurl_enable = 1

必须在模板的设置部分,而不是常量部分。

实际上,所有的配置都必须在设置中。常量在设置中仅用作占位符,因此您可以使用预定义的常量(包含在默认TS或某些扩展TS中),也可以自己定义它们并将引用{$constantName}放入设置中。

代码语言:javascript
复制
config.simulateStaticDocuments = 0
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
config.linkVars = L
config.prefixLocalAnchors = all
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39213208

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档