PDA

View Full Version : Point Mobile Users to Mobile Site


MikeyRitz
07-14-2015, 03:00 PM
Hi all, just building a new mobile site due to the nice folks at google complaining that my site isn't mobile friendly. I've placed the new m. html pages inside a new folder labelled m.

I've then placed the following code into the htaccess file:

# Check for mime types commonly accepted by mobile devices
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^ http://fishtailparkas.com/m/m./%{REQUEST_URI} [R,L]

Any idea's as to why it is not working? Any assistance gratefully received.

Ricky55
07-19-2015, 03:35 AM
I can't see that working too well.

You need something that detects the user agent string i.e. the browser they are using, for example mobile safari.

Take a look at something like: https://github.com/serbanghita/mobile-detect

MikeyRitz
07-20-2015, 10:58 AM
Many thanks for your reply Ricky. Most appreciated.

Ricky55
07-21-2015, 12:37 AM
no worries post back if you need any further help.

d a v e
07-21-2015, 10:22 AM
er, really you should be making one site that responds to different devices rather than having the headache of maintaining a separate mobile site. you're also restricted to two defined versions of your site - a large one and a small one and hoping that each one fits all the devices, however small or large.

edbr
07-23-2015, 02:10 AM
i agree with Dave. in the past however i used 1s_mobile to redirect at least parts of sites to a mobile only folder http://www.ismobile.com/