Welcome, Guest
Username Password: Remember me

[resolved] iPhones aren't redirecting to mobile site
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: [resolved] iPhones aren't redirecting to mobile site

[resolved] iPhones aren't redirecting to mobile site 12 years, 9 months ago #7431

  • brenpsnow
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
I have Domain Support set to "yes." I have redirect to domain under iphone/ipod set to "yes." My mobile site works great, but iPhones aren't being redirected. I've cleared cookies and used other phones. I've tried to force a redirect using htaccess, but my mobile site shares the same htaccess so I get a redirect loop. My rewrite conditions follow, any advice would be great.

RewriteCond %{HTTP_HOST} ^flagshiptutors.com$ [NC]
RewriteRule ^(.*)$ www.flagshiptutors.com/$1 [R=301,L]
The topic has been locked.

Re: iPhones aren't redirecting to mobile site 12 years, 9 months ago #7449

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
It's know issue of RC6, the patch for plugins/mobile/domains.php is here:
github.com/mobilejoomla/mobilejoomla/commit/966bba23351b0ad56a54844d92a2bd1fed41f678
The topic has been locked.

Re: iPhones aren't redirecting to mobile site 12 years, 8 months ago #7656

  • smeako
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Hi Guys, am struggling with this one. Can't seem to get my site to re-direct for iphone. Domain is diggerscc.com/myjoomla and subdomain is iphone.diggerscc.com.

Here is my domains.php file code for reference. Couldn't get it to laod as attachment for some reason.

<?php
/**
* ###DESC###
* ###URL###
*
* @version ###VERSION###
* @license ###LICENSE###
* @copyright ###COPYRIGHT###
* @date ###DATE###
*/
defined('_JEXEC') or die('Restricted access');

jimport('joomla.plugin.plugin');

class plgMobileDomains extends JPlugin
{
var $_domain_markup = null;

function plgMobileDomains(& $subject, $config)
{
parent::__construct($subject, $config);
}

function onAfterDeviceDetection(&$MobileJoomla_Settings, &$MobileJoomla_Device)
{
$is_joomla15 = (substr(JVERSION,0,3) == '1.5');
if($is_joomla15)
$config_live_site = 'config.live_site';
else
$config_live_site = 'live_site';

$this->getSchemePath($http, $base);

$markup = $MobileJoomla_Device['markup'];
$host = $_SERVER['HTTP_HOST'];
$domain_xhtml = $MobileJoomla_Settings['xhtml.domain'];
$domain_wml = $MobileJoomla_Settings['wml.domain'];
$domain_chtml = $MobileJoomla_Settings['chtml.domain'];
$domain_iphone = $MobileJoomla_Settings['iphone.domain'];

/** @var JRegistry $config */
$config =& JFactory::getConfig();

// Check for current domain
if(($markup=='xhtml' && $domain_xhtml && $host==$domain_xhtml) ||
($markup=='wml' && $domain_wml && $host==$domain_wml) ||
($markup=='chtml' && $domain_chtml && $host==$domain_chtml) ||
($markup=='iphone' && $domain_iphone && $host==$domain_iphone) )
{
$config->setValue($config_live_site, $http.'://'.$host.$base);
$this->_domain_markup = $markup;
return;
}

if($domain_xhtml && $host == $domain_xhtml)
{ // Smartphone (xhtml-mp/wap2) domain
$MobileJoomla_Device['markup'] = 'xhtml';
$config->setValue($config_live_site, $http.'://'.$host.$base);
$this->_domain_markup = $markup;
}
elseif($domain_iphone && $host == $domain_iphone)
{ // iPhone/iPod domain
$MobileJoomla_Device['markup'] = 'iphone';
$config->setValue($config_live_site, $http.'://'.$host.$base);
$this->_domain_markup = $markup;
}
elseif($domain_chtml && $host == $domain_chtml)
{ // iMode (chtml) domain
$MobileJoomla_Device['markup'] = 'chtml';
$config->setValue($config_live_site, $http.'://'.$host.$base);
$this->_domain_markup = $markup;
}
elseif($domain_wml && $host == $domain_wml)
{ // WAP (wml) domain
$MobileJoomla_Device['markup'] = 'wml';
$config->setValue($config_live_site, $http.'://'.$host.$base);
$this->_domain_markup = $markup;
}
else
{ // Desktop domain
$app =& JFactory::getApplication();
// is it non-first visit? Then don't redirect
if($app->getUserState('mobilejoomla.markup') !== null)
$MobileJoomla_Device['markup'] = '';
}
}

function onBeforeMobileMarkupInit(&$MobileJoomla_Settings, &$MobileJoomla_Device)
{
$markup = $MobileJoomla_Device['markup'];
$host = $_SERVER['HTTP_HOST'];
$domain_xhtml = $MobileJoomla_Settings['xhtml.domain'];
$domain_wml = $MobileJoomla_Settings['wml.domain'];
$domain_chtml = $MobileJoomla_Settings['chtml.domain'];
$domain_iphone = $MobileJoomla_Settings['iphone.domain'];

if($this->_domain_markup !== null)
{
if(!(($markup=='xhtml' && $domain_xhtml && $host==$domain_xhtml) ||
($markup=='wml' && $domain_wml && $host==$domain_wml) ||
($markup=='chtml' && $domain_chtml && $host==$domain_chtml) ||
($markup=='iphone' && $domain_iphone && $host==$domain_iphone)))
$MobileJoomla_Device['markup'] = $this->_domain_markup;
}

if($markup == '')
return;

$http = 'http';
if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off'))
$http .= 's';

$uri =& JURI::getInstance();
$parsed = parse_url($uri->toString());
$path = isset($parsed['path']) ? $parsed['path'] : '/';

/** @var JSite $app */
$app =& JFactory::getApplication();
switch($markup)
{
case 'xhtml':
if($domain_xhtml && $host != $domain_xhtml)
$app->redirect($http.'://'.$domain_xhtml.$path);
break;
case 'wml':
if($domain_wml && $host != $domain_wml)
$app->redirect($http.'://'.$domain_wml.$path);
break;
case 'chtml':
if($domain_chtml && $host != $domain_chtml)
$app->redirect($http.'://'.$domain_chtml.$path);
break;
case 'iphone':
if($domain_iphone && $host != $domain_iphone)
$app->redirect($http.'://'.$domain_iphone.$path);
break;
}
}

function getSchemePath(&$http, &$base)
{
if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off'))
$http = 'https';
else
$http = 'http';

$app =& JFactory::getApplication();
$live_url = $app->getCfg('live_site');
if($live_url)
{
$parsed = parse_url($live_url);
if($parsed !== false)
{
$base = isset($parsed['path']) ? $parsed['path'] : '/';
return;
}
}

if(strpos(php_sapi_name(), 'cgi') !== false && !empty($_SERVER['REQUEST_URI']) &&
(!ini_get('cgi.fix_pathinfo') || version_compare(PHP_VERSION, '5.2.4', '<')))
$base = rtrim(dirname(str_replace(array('"','<','>',"'"), '', $_SERVER['PHP_SELF'])), '/\\');
else
$base = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
}
}
Last Edit: 12 years, 8 months ago by smeako.
The topic has been locked.

Re: iPhones aren't redirecting to mobile site 12 years, 8 months ago #7769

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
Just set iphone.diggerscc.com as a subdomain name in Advanced tab of MJ settings. And note that MJ keeps path of URL, so full URL of mobile version will be iphone.diggerscc.com/myjoomla
The topic has been locked.

Re: iPhones aren't redirecting to mobile site 12 years, 8 months ago #7782

  • smeako
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Hi Dryabov,

Thank you for your response. I have now set the subdomain in MJ Advanced to iphone.diggerscc.com
Now when I type the full url diggerscc.com/myjoomla into the iphone it does re-direct to iphone.diggerscc,com/myjoomla but shows a hostgator error 404 and can't find the page.
If i manually type iphone.diggerscc.com into the iphone however the correct page shows. Do i have something configured incorrectly with my hosting account. I have set up the subdomain iphone.diggerscc.com in hostgator and added /myjoomla after public_html

Thanks
The topic has been locked.

Re: iPhones aren't redirecting to mobile site 12 years, 8 months ago #7789

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
 I have set up the subdomain iphone.diggerscc.com in hostgator and added /myjoomla after public_html

I don't know what options hostgator has for subdomains, but usually it's sufficient to set "Document Root" path of subdomain to be the same as main domain has.
The topic has been locked.

Re: iPhones aren't redirecting to mobile site 12 years, 8 months ago #7828

  • smeako
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
I'm not sure what exactly is meant by "Document Root". Am I correct in thinking the document root folder for my site at diggerscc.com/myjoomla would be public_html/myjoomla or would it simply be public_html? therefore if I remove the myjoomla addition from after public_html that should then point to the document root. Sorry for my ignorance
The topic has been locked.

Re: iPhones aren't redirecting to mobile site 12 years, 8 months ago #7829

  • smeako
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Hi Dryabov,

thanks for your help. Just fixed issue by removing /myjoomla from after public_html in the sbdomain
The topic has been locked.
  • Page:
  • 1
Time to create page: 0.14 seconds

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.