John
September 27, 2011, 08:28 AM
Hi folks,
During the Mobile Version Installation you may have a redirection problem, to fix the problem you should just add one condition in index.php file:
1. open the common index.php files located in script root directory
2. find the code (started at the line ~27):
$redirect_host = explode('/', RL_URL_HOME);
$redirect_host = 'http://'.$redirect_host[2].'/';
if ( false === strpos($_SERVER['HTTP_HOST'], 'www') && false != strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
elseif ( false !== strpos($_SERVER['HTTP_HOST'], 'www') && false === strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
and replace it with the following code:
if ( false === strpos($_SERVER['HTTP_HOST'], 'm.') )
{
$redirect_host = explode('/', RL_URL_HOME);
$redirect_host = 'http://'.$redirect_host[2].'/';
if ( false === strpos($_SERVER['HTTP_HOST'], 'www') && false != strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
elseif ( false !== strpos($_SERVER['HTTP_HOST'], 'www') && false === strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
}
3. Save file
Draw attention to the first line in new code:
if ( false === strpos($_SERVER['HTTP_HOST'], 'm.') )
m. is your sub-domain name with dot after it.
For example: if you use "mobile.domain.com" as mobile sub-domain the line should looks like:
if ( false === strpos($_SERVER['HTTP_HOST'], 'mobile.') )
Waiting for your questions.
John
During the Mobile Version Installation you may have a redirection problem, to fix the problem you should just add one condition in index.php file:
1. open the common index.php files located in script root directory
2. find the code (started at the line ~27):
$redirect_host = explode('/', RL_URL_HOME);
$redirect_host = 'http://'.$redirect_host[2].'/';
if ( false === strpos($_SERVER['HTTP_HOST'], 'www') && false != strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
elseif ( false !== strpos($_SERVER['HTTP_HOST'], 'www') && false === strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
and replace it with the following code:
if ( false === strpos($_SERVER['HTTP_HOST'], 'm.') )
{
$redirect_host = explode('/', RL_URL_HOME);
$redirect_host = 'http://'.$redirect_host[2].'/';
if ( false === strpos($_SERVER['HTTP_HOST'], 'www') && false != strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
elseif ( false !== strpos($_SERVER['HTTP_HOST'], 'www') && false === strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
}
3. Save file
Draw attention to the first line in new code:
if ( false === strpos($_SERVER['HTTP_HOST'], 'm.') )
m. is your sub-domain name with dot after it.
For example: if you use "mobile.domain.com" as mobile sub-domain the line should looks like:
if ( false === strpos($_SERVER['HTTP_HOST'], 'mobile.') )
Waiting for your questions.
John