I really tried searching about this in the internet but came upon diverse search results which barely specified what must be done specifficaly.
I’m now running ubuntu and php5 through nginx, amongst other things.
How is it that I can specify different layout and functionalities for mobile devices under the url “https://m. (…)”?
m for mobile (I’m aware this signature is not always used)
5
Firstly ensure that your view logic and domain logic are separate, you can search for “Model View Controller PHP” on Google for more information about this.
Once your view is separated from your logic it becomes a simple case of including a different view for mobile devices. There are many libraries for detecting if the client is a mobile browser such as http://mobiledetect.net/. These usually work via inspecting the User Agent string of the $_SERVER superglobal. http://php.net/manual/en/reserved.variables.server.php
Hope this helps
One approach is to create 2 web sites.
One’s your normal everyday site: http://www.example.com
The other is a copy of the everyday site, except you modify the CSS and make whatever other changes are needed to support your mobile users. By convention, you have your server folks set that up with the address http://m.example.com.
Now for the clever bit: in your main web site, you look at the browser string that accompanies every request. If that string looks like it belongs to a mobile device, you respond to the request with a 302 Redirect (or similar – there’s a lot of different ways to do this).
If you need the specifics on how to look at the browser string or do the redirect using your particular tool set, you’d be best off posting a separate question (or two) on Stackoverflow instead of here.