Redirect domainname.com site to m.domainname.com in django mobile

I want to redirect the user to m.domainname.com in my mobile browser. I want to use an existing website, but I'm redirecting to m.domainname.com. For this, how can I detect that the user is on mobile or desktop. And how can I redirect the mobile version of the same site.

using media screen i can create separate displays for mobile partitions

using bootstrap i can build a responsive website. but when its in the mobile browser i want to redirect the mobile version like m.domainname.com

How can i do this? And my site is in django.

+3


source to share


1 answer


You can use something like this: https://github.com/gregmuellegger/django-mobile The idea is to detect a mobile device in middleware ( https://docs.djangoproject.com/en/dev/topics/http / middleware / ).



So, if the middleware detects this request coming from a mobile device and the user requests a regular version of the site, you can redirect them to the mobile version of the site.

+1


source







All Articles