Permalinks - Standard and Mobile Sites

9 posts by 4 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 4, 2014   (RSS)

By Steve99 - January 8, 2014

Hello,

This permalinks question pertains to CMS website builds involving both standard and mobile versions versus a single responsive site on web host platforms that do not support the use of subdomains.

How can permalinks be set to work with both the standard desktop version and mobile version? (mirrored page names located within a "mobile" directory)

Example for LIVE end result:
domainname.com/permalink/
domainname.com/mobile/permalink/

Example One for DEVELOPMENT end result:
localhost/domainname.com/permalink/
localhost/domainname.com/mobile/permalink/

Example Two for DEVELOPMENT end result:
IPaddress/~hostingAccountName/permalink/
IPaddress/~hostingAccountName/mobile/permalink/

For added information, we do utilize the PREFIX_URL setting for dev.

Naturally we'd need to keep the same structure with the standard and mobile, and the client would be able to link items in the WYSIWYG so we'd need them to be mirrored for this scenario. We get some customers that want a standard and mobile version, and some that want responsive so we need solutions to handle both. Unfortunately sometimes we are faced with the client insisting on using their current web host that doesn't support subdomains (mobile.domainname.com versus domainname.com/mobile/.

Thanks in advance.

Regards,
Steve

By Dave - January 13, 2014

Hi Steve,

So you want to have two different permalinks for each record?  Or the presence of the /mobile/ prefix to indicate that a different viewer should be used? 

There's no support built into the plugin for anything like that right now.  I'm wondering if you could use the presence of a cookie to indicate which "view" (standard or mobile) of the page should be used.  And how does the "responsive" work?  Does it redirect to the other folder?  I'm also wondering about SEO issues from duplicate content on the different urls.

If you can let me know some more details I'll see what I can think of.   You might be able to address it with some simple custom programming to check for /mobile/ on permalinks. We'd have to see what was involved in that and make sure it didn't cause any other issues.

Dave Edis - Senior Developer
interactivetools.com

By Steve99 - January 14, 2014

Hi Dave,

It just dawned on me what you mentioned with the cookie... For non-responsive sites, this entire situation could be avoided by having a single set of files serving the "view" change based on conditional. Note to self, drink more coffee...

Thanks, Dave.

Best,
Steve

By ross - January 20, 2014

Hi Steve

Just want to confirm you have this all sorted out. If there is anything else we can help with, let me know :).

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Steve99 - January 21, 2014

Hi Ross,

Yep, I'm all set :) Thanks!

Steve

By Jesus - March 4, 2014

Hi Steve & Ross,

Will you please clarify a little bit what did you worked out with the cookies (and how you did it) for this?

As I'm thinking on a project where I might need something like this.

Thanks in advance,

Jesus

By Steve99 - March 4, 2014

Hi Jesus,

I ended up using a session variable that was set by the result of PHP Mobile Detect script. Each file (page) would then serve the Standard or Mobile views based on the "site version".

In my case I used a session var labeled "SITEVERSION" and had the "view" toggled based on if it was set as "mobile" or "standard".

The PHP script I use can be found here:
https://github.com/serbanghita/Mobile-Detect
or
http://mobiledetect.net/

Setting the session var portion of the code:

    if ($detect->isMobile() && !$detect->isTablet()) { 
      $_SESSION['SITEVERSION'] = 'mobile'; // set site version
    } else {
      $_SESSION['SITEVERSION'] = 'standard'; // set site version
    }

I wrapped my Standard and Mobile site code (same file/page) in a conditional having the appropriate version served.

Hope that helps. Thanks!

Steve

By Jesus - March 4, 2014

Hi Steve,

This looks really neat and interesting, will take a closer look during the weekend or probably sometime during nights this week.

Thanks a lot for the info!

Jesus