.htaccess or JavaScript Redirect


I have a mobile site at m.site.org and the main site at site.org I am using htaccess to redirect other pages but not sure if it's useful in this case.

If people are on a mobile phone and they go to the main site I want them to be redirected to the mobile version. Once on the mobile version we have an option to go back to the full site so I don't want them stuck in a redirect loop and can't go to the main desktop version.

I can not use server-side code and would like to know if there were an option without JavaScript (doubtful).


The link site.org I would like redirected but NOT site.org/index.html through htaccess. Possible? Does this help?

You should check this out. It provides regular expressions you use against the user-agent that can be done client side, and it is open source.

You can download an htaccess or get JS from it. Then edit at will. The htaccess gives you a rewrite cond. JS will give you a function.

Now this won't scale if a new phone comes to the market, but it's pretty decent and you can change it as new things come. Or you can run a process that fetches and deploys the new regular expressions periodically