-->

How to redirect URL to mobile version?

2019-09-20 16:12发布

问题:

I want to redirect some URL to mobile version, if the user agent is a mobile.

Example :

klikkarir.com/jawa-pos/5215/lowongan-call-center-accounting-administration-pt-asia-teleservices-januari-2010.html

will redirect to :

m.klikkarir.com/5215/lowongan-call-center-accounting-administration-pt-asia-teleservices-januari-2010/

somebody help me.

回答1:

I use http://detectmobilebrowser.com, and found it is the quickest and easiest way. It works quite well. This site generates server scripts automatically (php, perl, python, coldfusion, apache, jquery, etc.) that detects mobile browser and redirects accordingly. You can just copy and paste the code somewhere in your Index file.



回答2:

The best method is to use WURFL to detect if a mobile device is hitting your page, several (php,java,c++) interfaces exist.

If you want to have simpeler but less accurate solution a quick useragent comparison might be sufficient, example.



回答3:

You could try the Mobify Me service, there is a free version too.

Off topic, Start accepting answers



回答4:

I believe there are three ways to go about this first detecting the screen size by number of pixels. I have tried this method and It works within parameters (HD and high resolution screens on mobile devices vs older low resolution desktop screens) another approach suggestion several places (http://www.inmotionhosting.com/support/website/how-to/mobile-redirect) is to use the .htaccess file. The idea here is to screen browsers on their acceptance of mobile MIME types - as I suspect there is no great push for full screen devices to take mobile MIME types this seems fairly reliable with the caveat that on tablet devices you may get the mobile version when they are capable of handling the main version. The third of course is to use the script solutions noted above. Luck DPR