繁体   English   中英

typo3 realurl仅显示网址中的一个细分

[英]typo3 realurl show only one segment in url

我在typo3中研究realurl,并花了几个小时弄清楚为什么typo3在URL中仅显示一个片段。

网站结构如下:

在此处输入图片说明

我从“ munchen-maistrasse”子页面获得的URL是:

http://www.bernd-gruber.at/munchen-maistrasse/

我希望它是:

http://www.bernd-gruber.at/referenzen/munchen-maistrasse/

这是我的服务器.htaccess文件:

<FilesMatch "\.(js|css)$">
  <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 7 days"
  </IfModule>
  FileETag MTime Size
</FilesMatch>

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]

</IfModule>

AddType video/x-m4v .m4v
AddType video/ogg .ogv
AddType video/webm .webm
AddType video/x-m4v .m4v
AddType application/ogg .ogg 

我在打字稿中不使用config.baseURL:

config.absRefPrefix = /
config.prefixLocalAnchors = all

在我的根页面上。 我用光了解决方案。

您需要自己的配置才能达到此目的。

1)在Extension Manager -> RealUrl > Configuration您必须禁用自动配置并在其中定义您自己的realUrl配置文件的路径。

2)您应确保该(页面)。 设置config.tx_realurl_enable = 1

3)为您的网站进行正确的realUrl配置后,您必须截断所有realUrl缓存表,或者只是删除所有ID to Path mappings

以下是标准realUrl配置模板的一些示例:

<?php
$realurl_template = array(

    'init' => array(
        'appendMissingSlash'    =>  'ifNotFile,redirect',
        'enableCHashCache'      =>  1,
        'enableUrlDecodeCache'  =>  1,
        'enableUrlEncodeCache'  =>  1,
        'emptyUrlReturnValue'   =>  '/'
    ),

    'preVars' => array(
        array(
            'GETvar'    =>  'no_cache',
            'valueMap'  =>  array(
                'nc'    =>  1,
            ),
            'noMatch'   =>  'bypass',
        ),
    ),

    'fileName' => array(
        'index' => array(

        ),
    ),

    'postVarSets' => array(
        '_DEFAULT' => array (

        ),
    ),

    'pagePath' => array(
        'type' => 'user',
        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
        'spaceCharacter' => '-',
        'languageGetVar' => 'L',
        'expireDays' => 3,
    )
);

# Configurate domain names
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
    '_DEFAULT' => $realurl_template,
    'domain.com' => $realurl_template,
    'www.domain.com' => $realurl_template,
);

$TYPO3_CONF_VARS['EXTCONF']['realurl']['domain.com']['pagePath']['rootpage_id'] = 1;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.domain.com']['pagePath']['rootpage_id'] = 1;

# Unset template
unset($realurl_template);
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM