I've setup a special mobile store/store front under a subdomain – www.m.mydomain.com according to this tutorial.
I was going to put this code in the Miscellaneous scripts to make the system detect that a customer is connecting from a mobile device and forward the traffic to www.m.mydomain.com:
But now I'm thinking a better solution might just be through changing the .htaccess
file as explained here.
But I don't understand where to put that code into? Also – that post is from 2010. Is there something newer to go with given the development in the mobile devices and tablets?
I also need to place a large button on the mobile site (at www.m.mydomain.com ) that would re-direct customers to the desktop version of the site (www.mydomain.com) if they choose to. What is the best way to do that?
I mean – How can this work? Will it not be stuck in a loop? When the customer clicks the button that will send it to www.mydomain.com, won't the script once again detect that it is a mobile device and transfer the traffic back to www.m.mydomain.com ? I read about doing it with cookies but how exactly? And how would I set that button up?
I am looking for a simple solution as in: take this code and put it here. Change this code here and you are done! :o)
In my example my desktop site is: www.mydomain.com and my mobile is at: www.m.mydomain.com while my desktop store name and store front name is: mydomain.com and my mobile store name and store front name is: mmydomaincom
Updated December 12th:
Please don't tell me to load a different theme. I already have a nice responsive theme! This is not the problem. The reason I want to redirect to my mobile site (located at www.m.mysite.com) is that I have around 50 products on my desktop front page and a lot of things (such as text put on there by the SEO company) that are just taking up space and I don't need to display that clutter on mobile devices. I think that ordering on a mobile device should be fast and easy without unnecessary junk. That said – I am not trying to reinvent the wheel here. I need 2 things.
1. Detect the mobile device and if that is so – load www.m.mysite.com instead of www.mysite.com
2. Add a button for people who for whatever reason (maybe they are connected to a fast wifi connection) decide they want the desktop version instead and make it work when they click it to display www.mysite.com
If you go to www.ebay.com on your mobile phone – it redirects to "m.ebay.com" Same with YouTube, Facebook, Twitter, LinkedIn…So don't tell me this is an old age approach. If these multi-billion dollar companies are doing it – it has some logic behind it….
Best Answer
https://stackoverflow.com/questions/3680463/mobile-redirect-using-htaccess
http://wpandsuch.com/redirect-to-a-mobile-site-with-htaccess-and-set-a-cookie-to-break-redirect/
Magento Redirect to mobile website when on Smart Devices
https://github.com/LimeSoda/LimeSoda_MobileRedirect
https://github.com/sebarmeli/JS-Redirection-Mobile-Site
https://github.com/vkathirvel/Magento-Extension-MobileDetect
http://mobiledetect.net/
Multi store magento redirects to main store
https://www.cloudways.com/blog/create-and-configure-multistore-magento-2/
Magento 2 with multiple domain names
This is the best article so far: https://www.forgeonline.co.nz/magento-multistore-website-shopfront/
U need to set Cookie & Flag then it will work out. U can also refer to Magento Default
.htaccess
which provides already