Redirect to Mobile Version

Hey guys, I am trying to use kirby for a new project that I am working on. And so far everything works just fine. (loving it btw)

But I am stuck (it is probably simple, but I don’t know how to do it):
How would you redirect the user if he is on a mobile device? For bandwidth purposes I want to separate the desktop and mobile versions, as there will be a lot more content for the desktop version.

I you really need some kind of device detection, you could use something like Mobile Detect.

You can use Detector:

it could be done using a css with mediaqueries which hides anchor links to desktop version and shows (hidden on desktop) those linking to mobile version. (desktop link url)
=> m.example.content-a (mobile link url)

Hello! I need to add Module Detect to my Kirby installation but I’m unable to understand how to do it…

I tried to make a plugin but I can’t reach the goal as I’m not sure on how to create it correctly…
Could you give me some hint?

I only need: if (is mobile == true): do something


If you use the mobile detect library suggested by @malvese, all you need to do is out the Mobile_Detect.php file into your plugins folder. Then it is automatically loaded and you can use it anywhere, following the documentation, e.g.


$detect = new Mobile_Detect; 
 if ($detect->isMobile()) {
   echo "I'm a mobile device";