0

I have a webpage tree structure given below

Web Tree Structure

In this tree when I access like http://localhost/mysite its redirect to "Root Local" and accessed like http://192.168.1.20/mysite/ its redirect to "Root IP" by setting it in domain.

I implemented realURL extension. and it working fine for localhost and URL become http://localhost/mysite/en/home/ .

But when I tried to access it by 192.168.1.20 as domain, the URL shows like http://192.168.1.20/mysite/en/home/. Bur it shows the blank web page with error "This webpage has a redirect loop" .

My realurl_conf.php looks like

<?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;
  }

?>

And I added in the main Template

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

for the IP Address and

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

for local host

Why it not working for the IP address as domain.?? How can I make it work ? Thanks in advance

Vishnu Prasad
  • 729
  • 1
  • 11
  • 28

1 Answers1

0

Finally I found an answer myself. I am not fully known how it works. If anyone can help me please be free to add it.

I edited my realurl_conf.php like this and work like a charm..

<?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;
  }

?>

Thank you.

Vishnu Prasad
  • 729
  • 1
  • 11
  • 28