First detect if the device is mobile or not.
Use the ua-parser library for that,
https://github.com/tobie/ua-parser/tree/master/php

Next redirect using php headers or meta redirect.
Most...