I have written some PHP that detects whether a user is visiting my blog posts using a mobile device or a computer.
Basically, I need a script that edits the URL dynamically if a user is visiting my blog post with a mobile.
For example, my blog post URLs are like this:
http://www.example.com/blog/blog-post-1/
http://www.example.com/blog/welcome-to-my-blog/
http://www.example.com/blog/another-blog-post/
Users should be dynamically redirected to:
http://www.example.com/m/blog/blog-post-1/
http://www.example.com/m/blog/welcome-to-my-blog/
http://www.example.com/m/blog/another-blog-post/
I also have the device detection working in PHP, so I just need the script to insert inside the PHP condition.
Any ideas?
phpquestion, and possibly anhtaccessquestion, but not ajavascriptorjqueryquestion.