Need help in HTACCESS redirect


How can I achieve this in HTACCESS… What I want is that if a user is using a Smartphone device and access the link http://luxury.localhost/others/mypage.html he will be redirected to http://luxury.localhost/sp/entry but if he is just using a PC he will be redirected to http://luxury.localhost/entry page…

#the logic is something like this
# If using smartphone
RedirectMatch /others/mypage.html /sp/entry/

#else if using PC
RedirectMatch /others/mypage.html /entry/

PLease help me.



Maybe these articles can help.

Although I think the best choice is to simply have a link from the main site to your mobile site and give users the choice rather than forcing it on them (or at least make sure there is a link back to the main site on the mobile site and remember the users preference).

You could try redirecting based on user agent strings or use @media in css to detect screen size and adjust accordinly.