Search

I'm going to detect the user's device using one of the existing extensions.

Then, i want to be able to redirect from mywebsite.com/blog/article to mywebsite.com/MOBILE/blog/article for example.

I've made a htaccess redirect that identifies the string mobile from the beginning of the url and add ?mobile=true to it. So i can use templates to serve the right content.

How can i create this page redirect? Does it have to be an event attached to every page? I also want to create a link from the mobile and tablet version to the classic version. I guess i'll have to use cookies, right?

You could just add a .htaccess rule that detects mobile and adds the ?mobile=true parameter.

In your XSLT this would be accessible by $url-mobile or /data/params/url-mobile, which you can use to do what you like with.

Depending on what extension you use, I believe some already include this information in your XSLT, so there's no need for the ?mobile parameter.

Mobile Device Detection does this.

@brendo: I've already done this. I would like to redirect tablet users from mywebsite.com/page to mywebsite.com/tablet/page and mobile users to mywebsite.com/mobile/page.

I really wouldn't go to the trouble of doing all the redirecting (says the guy who loves redirects).

If you use the Device Categorizr extension to output a parameter of mobile, tablet, desktop, or tv then you can just do everything in the xslt. You wouldn't even need the rewrite then.

Thanks John. Device Categorizr is great! Maybe a should really give up redirecting!

The power that's there to deliver content differently with templates and modes based on something simple like a parameter is awesome. Redirects have their place, and I'm in the camp that says mobile should be under the same URL as normal.

If you still decide to go the redirect route, you should look at the GET parameter along with URL Router, it's the biz.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details