簡體   English   中英

當域名為IP地址時,RealURL擴展不適用於typo3 v6.2.x.

[英]RealURL extension not working for typo3 v6.2.x when domain given as IP Address

我有下面給出的網頁樹結構

網絡樹結構

在這個樹中,當我訪問http://localhost/mysite它重定向到“Root Local”並訪問類似http://192.168.1.20/mysite/通過在域中設置它重定向到“Root IP”。

我實現了realURL擴展。 並且它對於localhost正常工作,URL變為http://localhost/mysite/en/home/

但當我嘗試以192.168.1.20作為域訪問它時,URL顯示為http://192.168.1.20/mysite/en/home/ 它顯示空白網頁, 錯誤此網頁有重定向循環 ”。

我的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地址。?? 我該如何運作? 提前致謝

最后我自己找到了答案。 我不知道它是如何工作的。 如果有人可以幫助我,請隨意添加。

我像這樣編輯了我的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;
  }

?>

謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM