typo3:realurl扩展 - 配置问题,在url中包含path-fragment

时间:2013-06-28 11:57:30

标签: .htaccess typo3 realurl

假设我有一个网站www.mywebsite.com。我的typo3 v4.7前端位于,比方说,

www.mywebsite.com/cms/index.php

,后端位于www.mywebsite.com/cms/typo3 /.

如何配置realurl扩展生成的“友好”网址,其方式是网址映射如下:

www.mywebsite.com/cms/index.php?id=45

www.mywebsite.com/cms/something

我想使用realurl的自动配置功能。

这就是autoconfig文件的样子:

<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
  '_DEFAULT' => 
  array (
    'init' => 
    array (
      'enableCHashCache' => true,
      'appendMissingSlash' => 'ifNotFile,redirect',
      'adminJumpToBackend' => true,
      'enableUrlDecodeCache' => true,
      'enableUrlEncodeCache' => true,
      'emptyUrlReturnValue' => '/cms/',
    ),
    'pagePath' => 
    array (
      'type' => 'user',
      'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
      'spaceCharacter' => '-',
      'languageGetVar' => 'L',
      'rootpage_id' => '13',
    ),
    'fileName' => 
    array (
      'defaultToHTMLsuffixOnPrev' => 0,
      'acceptHTMLsuffix' => 1,
      'index' => 
      array (
        'print' => 
        array (
          'keyValues' => 
          array (
            'type' => 98,
          ),
        ),
      ),
    ),
  ),
);
?>

我无法完成它。此网站上有更多虚拟主机。我不想为这个typ3安装构建一个新的专用虚拟主机。

目前,重定向不起作用。有一个通用的“在这台服务器上找不到页面...”。 Apache发布的错误消息。

<IfModule mod_rewrite.c>

        RewriteEngine on
        #RewriteBase /cms/
       RewriteRule ^/cms/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)(/.*)?$ - [L]
</IfModule> 

2 个答案:

答案 0 :(得分:0)

我认为您的问题目前与RealURL及其配置无关。你有mod_rewrite配置的问题。从TYPO3附带的原始版本开始,因为您发布的位缺少关键规则。尝试设置RewriteBase,但如果它不起作用,请将其禁用。

请注意,它实际上是调用TYPO3并使其处理请求的最后一条规则(RewriteRule .* index.php [L]),这显然目前尚未发生。

<IfModule mod_rewrite.c>

# Enable URL rewriting
RewriteEngine On

# Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
RewriteBase /cms/

# Rule for versioned static files, configured through:
# - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
# - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

# Stop rewrite processing, if we are in the typo3/ directory.
# For httpd.conf, use this line instead of the next one:
# RewriteRule ^/TYPO3root/(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]

# Redirect http://example.com/typo3 to http://example.com/typo3/index_re.php and stop the rewrite processing.
# For httpd.conf, use this line instead of the next one:
# RewriteRule ^/TYPO3root/typo3$ /TYPO3root/typo3/index.php [L]
RewriteRule ^typo3$ typo3/index_re.php [L]

# If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

# Main URL rewriting.
# For httpd.conf, use this line instead of the next one:
# RewriteRule .* /TYPO3root/index.php [L]
RewriteRule .* index.php [L]

</IfModule>

答案 1 :(得分:0)

只是一个提示:在子文件夹中使用TYPO3,将它放入像cms.mydomain.com这样的子域更加舒服。在这种情况下,您不需要额外的重新配置,并且所有元素都像普通域一样工作。

相关问题