eZ Community » Forums » Install & configuration » Keeping same urls for desktop and mobile
expandshrink

Keeping same urls for desktop and mobile

Keeping same urls for desktop and mobile

Thursday 22 November 2012 12:39:56 pm - 5 replies

Hi, we have a siteaccess for mobile, and all templates are mobilefriendly. But when a user is trying to access a deep-link (site.com/articles/article900/) with their mobile they get redirected to the front page (site.com/mobile_access).

We want them to have the same url, is this possible?

I've tried to comment out the mobileaccessurl but then I create redirect loops...

Thursday 22 November 2012 1:40:23 pm

Hi,

 

what kind of mobile device detection are you using and how?

Thursday 22 November 2012 1:57:20 pm

Hi, thanks for responding! happy.gif Emoticon

We're using ez's DetectMobileDevice and MobileSiteAccessList[]=site_mobile.

I've tried to add an url translator of site_mobile to / but it says "the url alias site_mobile already exists, and it points to content/view/full/2. But I can't see it under ez admin/url translator.

It might be from the variable IndexPage, but it confuses me if this is the reason for not being able to access deep links when visiting a full link on a cellphone.

Modified on Thursday 22 November 2012 1:57:52 pm by Øyvind Høysæter

Friday 23 November 2012 6:49:46 am

My recommendation would be to create a HostMatch site access of m.site.com

settings/override/site.ini.append.php

[SiteAccessSettings]
AvailableSiteAccessList[]=site
AvailableSiteAccessList[]=mobile
 
ForceVirtualHost=true
MatchOrder=host
HostMatchType=map
HostMatchMapItems[]=site.com;site
HostMatchMapItems[]=m.site.com;mobile
...
MobileSiteAccessList[]=mobile
MobileSiteAccessURL=http://m.site.com
DetectMobileDevice=enabled

Keep the mobile site out of the search engines:

RewriteCond %{HTTP_HOST} ^m\..*
RewriteRule ^robots\.txt$ m.robots.txt [L]

 

(m.robots.txt disallows all bots)

This is because the main content is probably already indexed.  If you keep the mobile site out of the search engine, mobile devices will be redirected to the mobile content, but it is extremely unlikely that a desktop browser will ever see the m.site.com content.

Friday 23 November 2012 10:20:55 pm

Hi Betsy, thanks for responding. This part is working now. But when users are sent desktop-links on cellphones the cellphone is being redirected to the frontpage, and not the full link they originally clicked on.

Saturday 24 November 2012 2:53:57 pm

Change kernel/private/classes/ezpmobiledeviceregexpfilter.php  - near line 112 - to add the REQUEST_URI to the redirect URL:

if ( !isset( $_COOKIE['eZMobileDeviceDetect'] )
                 && !in_array( $currentSiteAccess['name'],  eZINI::instance()->variable( 'SiteAccessSettings',  'MobileSiteAccessList'  ) ) )
        {
             $http->redirect( eZINI::instance()->variable(  'SiteAccessSettings', 'MobileSiteAccessURL' ) . eZSys::serverVariable(  'REQUEST_URI' ) );
            eZExecution::cleanExit();
        }

 

Version: Community Project 2012.3

Modified on Saturday 24 November 2012 2:56:12 pm by Betsy Gamrat

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from