当域作为 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/
。
Bur 它显示空白网页 error "This webpage has a redirect loop" .
我的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;
}
?>
谢谢。
我有下面给出的网页树结构
在这棵树中,当我像 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/
。
Bur 它显示空白网页 error "This webpage has a redirect loop" .
我的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;
}
?>
谢谢。