0

我有一个下面给出的网页树结构

网络树结构

在这棵树中,当我 通过在域中设置它重定向http://localhost/mysite到“根本地”并像重定向到“根 IP”一样访问时。http://192.168.1.20/mysite/

我实施realURL了扩展。它可以正常工作,localhost并且 URL 变为 http://localhost/mysite/en/home/.

但是当我尝试通过192.168.1.20域访问它时,URL 显示为http://192.168.1.20/mysite/en/home/. Bur 它显示带有错误此网页有重定向循环”的空白网页。

我的realurl_conf.php 样子

<?php

  $TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
    // sitename
    '_DEFAULT' => array(
      // initialization
      'init' => array(
        'useCHashCache' => '0', // für tt_news
        'enableCHashCache' => true,
        'appendMissingSlash' => 'ifNotFile',
        'enableUrlDecodeCache' => true,
        'enableUrlEncodeCache' => true,
        'emptyUrlReturnValue' => '/'
      ),
      // first url rewriting segment
      'preVars' => array(
        array(
          'GETvar' => 'L',
          'valueMap' => array(
            'de' => 3,
            'en' => 1,

          ),
          'valueDefault' => 1,
        ),
      ),
      // second url rewriting segment
      'pagePath' => array(
        'type' => 'user',
        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
        'spaceCharacter' => '-',
        'languageGetVar' => 'L',
        'expireDays' => 30,
        'rootpage_id' => 1
      ),
      // third url rewriting segment
      'fixedPostVars' => array(
      ),
      // forth url rewriting segment
      'postVarSets' => array(
        '_DEFAULT' => array(
          /*
              no_cache setting should not be used in preVars
              @see http://dmitry-dulepov.com/article/do-not-use-no-cache-as-prevar.html
          */
          'nc' => array(
            'type' => 'single',
            'GETvar' => 'no_cache',
          ),

        )
      ),

    )
  );

  $byPassLVar = array(
    array(
      'GETvar' => 'L',
      'valueMap' => array(),
      'noMatch' => 'bypass'
    )
  );


  $TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
  $TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['pagePath']['rootpage_id'] = 1;
  $TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['preVars'] = $byPassLVar;
  $TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['192.168.1.20'];
  $TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['pagePath']['rootpage_id'] = 3;
  $TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['preVars'] = $byPassLVar;



  switch (t3lib_div::getIndpEnv('HTTP_HOST')) {
    case 'Root_Local':
    $_GET['L'] = 1;
    break;
    case 'Root_IP':
    $_GET['L'] = 1;
    break;
    default:
    $_GET['L'] = 1;
    break;
  }

?>

我在主模板中添加了

   config.simulateStaticDocuments = 0
   config.baseURL = http://192.168.1.20/mysite/
   config.tx_realurl_enable = 1

对于 IP 地址和

   config.simulateStaticDocuments = 0
   config.baseURL = http://localhost/mysite/
   config.tx_realurl_enable = 1

对于本地主机

为什么它不适用于IP地址作为域.?? 我怎样才能使它工作?提前致谢

4

1 回答 1

0

最后我自己找到了答案。我不完全知道它是如何工作的。如果有人可以帮助我,请随时添加。

realurl_conf.php像这样编辑了我的作品,并像魅力一样工作..

<?php

  $TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
    // sitename
    '_DEFAULT' => array(
      // initialization
      'init' => array(
        'useCHashCache' => '0', 
        'enableCHashCache' => true,
        'appendMissingSlash' => 'ifNotFile',
        'enableUrlDecodeCache' => true,
        'enableUrlEncodeCache' => true,
        'emptyUrlReturnValue' => '/'
      ),
      // first url rewriting segment
      'preVars' => array(
        array(
          'GETvar' => 'L',
          'valueMap' => array(
            'de' => 3,
            'en' => 1,

          ),
          'valueDefault' => 'en',
        ),
      ),
      // second url rewriting segment
      'pagePath' => array(
        'type' => 'user',
        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
        'spaceCharacter' => '-',
        'languageGetVar' => 'L',
        'expireDays' => 30,
        'rootpage_id' => 1
      ),
      // third url rewriting segment
      'fixedPostVars' => array(
      ),
      // forth url rewriting segment
      'postVarSets' => array(
        '_DEFAULT' => array(
          /*
              no_cache setting should not be used in preVars
              @see http://dmitry-dulepov.com/article/do-not-use-no-cache-as-prevar.html
          */
          'nc' => array(
            'type' => 'single',
            'GETvar' => 'no_cache',
          ),

        )
      ),

    )
  );

  $TYPO3_CONF_VARS['EXTCONF']['realurl']['192.168.1.20'] = array(
    // sitename

      // initialization
      'init' => array(
        'useCHashCache' => '0', 
        'enableCHashCache' => true,
        'appendMissingSlash' => 'ifNotFile',
        'enableUrlDecodeCache' => true,
        'enableUrlEncodeCache' => true,
        'emptyUrlReturnValue' => '/'
      ),
      // first url rewriting segment
      'preVars' => array(
        array(
          'GETvar' => 'L',
          'valueMap' => array(
            'de' => 3,
            'en' => 1,

          ),
          'valueDefault' => 'en',
        ),
      ),
      // second url rewriting segment
      'pagePath' => array(
        'type' => 'user',
        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
        'spaceCharacter' => '-',
        'languageGetVar' => 'L',
        'expireDays' => 30,
        'rootpage_id' => 3
      ),
      // third url rewriting segment
      'fixedPostVars' => array(
      ),
      // forth url rewriting segment
      'postVarSets' => array(
        '192.168.1.20' => array(
          /*
              no_cache setting should not be used in preVars
              @see http://dmitry-dulepov.com/article/do-not-use-no-cache-as-prevar.html
          */
          'nc' => array(
            'type' => 'single',
            'GETvar' => 'no_cache',
          ),
        )
      ),
  );

  $byPassLVar = array(
    array(
      'GETvar' => 'L',
      'valueMap' => array(),
      'noMatch' => 'bypass'
    )
  );


$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['pagePath']['rootpage_id'] = 1;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_Local']['preVars'] = $byPassLVar;

$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['192.168.1.20'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['pagePath']['rootpage_id'] = 3; //overwrite root page ID with the one for this specific domain
$TYPO3_CONF_VARS['EXTCONF']['realurl']['Root_IP']['preVars'] = $byPassLVar;



  switch (t3lib_div::getIndpEnv('HTTP_HOST')) {
      case 'Root_Local':
    case 'Root_Local':
    $_GET['L'] = 1;
    break;
     case 'Root_IP':
    case 'Root_IP':
    $_GET['L'] = 1;
    break;
    default:
    $_GET['L'] = 1;
    break;
  }

?>

谢谢你。

于 2015-02-12T04:31:28.223 回答