I need original code, that is not copyrighted by someone else, for redirecting mobile phones from a primary website to the mobile device. And, back again.
The code needs to redirect all mobile devices from one url to another (mobile) url. If the user wants to visit the main site, they need to be able to do that.
Please explain how this code will be implemented.
No htaccess code please. Only php and/or javascript.