Mobile Redirect Code Discussion Index
Posted by Quimby Melton on February 5, 2007
The popularity of the Studio Hyperset Mobile Redirection PHP script has created many comments and postings. Rather than continue to update each page in the conversation with a link to further discussions, SH decided to make this index. On each new discussion posting (and now on all the old ones), a link to this index will be/has been posted so that users can browse all the relevant postings no matter what specific post they happen to load.
On this index page, I’ll also post a link to the most current version of the script for ease of access to it.
This should help keep things better organized.
Keep the comments and suggestions coming!
CURRENT SCRIPT(S) (2/5/06)
DISCUSSION INDEX:
- 11/12/06 – “Mobile Redirect Update“
- 1/11/07 – “Mobile Redirect Code Update“
- 2/5/07 – “Another Mobile Redirect Code Update“
FINAL UPDATE: Detecting and automatically redirecting website visitors who visit a standard webpage / website on mobile, handheld, wireless, PDA, or cel / cell phone devices / browsers to a mobile version of the webpage or website « hyper/boʊl/e said
[...] Mobile Redirect Code Discussion Index [...]
Detecting and automatically redirecting website visitors who visit a standard webpage / website on mobile, handheld, wireless, PDA, or cel / cell phone devices / browsers to a mobile version of the webpage or website « hyper/boʊl/e said
[...] Mobile Redirect Code Discussion Index [...]
Another Mobile Redirect Code Update « hyper/boʊl/e said
[...] Mobile Redirect Code Discussion Index [...]
sreejith said
Hi,
code for redirection looks nice. I am a beginner to wap devolopment. How can we find out that a request is coming from a WAP enable mobile. Pls give a reply ASAP.
Thanks,
sreejith.
studiohyperset said
Sreejith,
I’ve done some sleuthing and found some articles on detecting WAP enabled phones. Cleraly, that function is beyond the scope of the mobile redirect code at present. However, if you’re able to incorporate some of these elements into the script, let me know. I/we can work on a new version of the script that incorporates WAP and Mobile detection.
Thanks for your interest, and here are some links for your perusal:
- http://www.andymoore.info/php-to-detect-mobile-phones/
- http://www.expertsrt.net/main/forum/topic,427.msg7747
- http://codingforums.com/archive/index.php?t-11645.html
Others might be able to add more insight.
Andy Moore said
Hi,
Thanks for the link above
header(”location: $mobile”);
echo ‘Mobile Device detected’;
break;
}
Both the echo and break would be redundant if a mobile was detected as the user would have been sent away from the page by then.
You might consider making the redirect a 302, it appears from reading up on ‘Trusted Mobile Payment Framework’ Scheme Rules that the UK networks suggest 302 redirects be the best course of action.
Other than sniffing out the user agent you can also sniff the content-accept headers for wap and mobile keys that stand out.
If you wanted to go a bit more advanced you could get the handsets’ IP address and run it against my list of WAP Carrier IP Addresses to try and home in on the actual carrier they are using too.
As I said on my site, there’s many ways to skin a cat
Cheers
Andy
Studio Hyperset Mobile Redirection Code and the iPhone « hyper/boʊl/e said
[...] Mobile Redirect Code Discussion Index [...]
Josh said
Awesome script guys!
By the way, StudioHyperset.mobi is still available, I would register it before some cybersquatter does.
Josh
O. Quimby Melton said
Josh,
You’re a good man. Many thanks.
~Q.
Jim Casey said
I am trying to understand how this works…
I tried to install this in my index.html page and uploaded the two php scripts to no avail…
HELP???
Jim Casey said
I then tried it in an index.php page and got this..
Parse error: parse error, unexpected ‘)’ in /nfs/cust/9/6/4/djmain/web/index.php on line 2
O. Quimby Melton said
Jim,
That’s a path error, brah. You need to find the correct PHP path on your server. Unless you administer the server yourself, I’d check with the hosting company or whoever hosts your site.
O. Quimby Melton said
This from Jim again:
“According to my webhost, this is the path… /usr/local/bin/php/ Where do I change this?”
My response:
“The absolute path to PHP on the server isn’t something you can change per se; but to get around the problems you’re experiencing, try calling the script using the full WWW address of the script in your header. This is what I do. I’ve used “[]” in place of “” in the example below because I don’t want your spam software to refuse delivery of this string.
[script type=”text/php” language=”php” src=”http://www.YOURDOMAINHERE.com//mobile.php”][/script]
Also, the script won’t work on my host unless I put it in the main directory of the site. Thus, though I usually provide a /scripts/ sub directory, I have to put the “mobile.php” script in my main /public_html_ directory. This is just a host/browser quirk, and I doubt there’s much we can do about it.
See if this works. If it doesn’t, contact your host to see what they recommend.”
Frank Biganski said
Could someone publish an installation guide for us non-developers? I see where I would replace the StudioHyerset URL with my http://mobile.mrtownhome.net URL, but I just don’t get where to place the scripts. I’ve only set up PHP for my Blog site, and am looking for an admin page. Any How-To guide will be tremendously appreciated.
Thanks,
Frank
O. Quimby Melton said
Frank,
There’s nothing to it, amigo. Just call the scripts in the head of your homepage (eg., http://www.mrtownhome.net/index.php).
I think this post outlines the procedure: http://studiohyperset.wordpress.com/2006/11/12/mobile-redirect-update/
If not, browse the above index.
Let me know if you have any other questions.
~Q.
cuulseo said
На этот раз его реально взломали:
http://depositfiles.com/files/8506962
или
http://depositfiles.com/files/8506962
Frank Biganski said
For those like me who are looking for a mobile redirect script that does not involve PHP, check this out — an htaccess script and it redirects!
http://ohryan.ca/blog/2007/10/29/htaccess-mobile-browser-redirect
reflash said
Frank,
I just found this script today, and had a bit of an issue getting it to work. For my use, I had to put the actual php code as the very first thing on the index.php page, and then it worked just fine.
Thanks, Q, for an excellent script. Many of my clients (and their clients) don’t have iPhones, so being able to redirect for other phones is a great thing.
ReFlash
Oliver Melton said
Glad this continues to work for folks.
PHP Code to Redirect Mobile/Handheld Users | Bavota San said
[...] by a client and found a great piece of code to help with the whole redirection issue. I found a great article about this issue and an awesome piece of code that makes it all [...]
Deshmukh said
Best method of Redirecting your website to mobile website subdomain is shown on this link: http://www.deshmukhelectric.com/engineering/?p=34
The website also contains files which you can simply download and upload to your website with minor changes.
Quimby Melton said
Very nice. Thanks for the tip.
Idel said
I have published the last version of “Apache Mobile Filter”, this open source project has in the first 8 months, more than 1100 downloads from sourceforge and I suppose the same from CPAN.
The Apache Mobile Filter allows you to access WURFL from any programming language, not just Java and php that is traditionally used for dynamic mobile web sites.
The module detects the mobile device and passes the WURFL capabilities on to the other web application as environment variables. It can also be used to resize images on the fly to adapt to the screen size of the mobile device.
Try it and let me know your opinion.
For more info: http://www.idelfuschini.it/it/apache-mobile-filter-v2x.html
I have made two test pages:
PC Test Page: http://apachemobilefilter.nogoogle.it/php_test.php
Mobile Test Page: http://apachemobilefilter.nogoogle.it