Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
WEB:Web Design Forum- TutorialsDreamweaver Forum- TutorialsFlash Forum- TutorialsWeb Streaming

Redirecting to mobile website

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Mike HealeyRedirecting to mobile website
by on Jul 9, 2008 at 7:52:14 pm

Hey folks - Not sure this is the appropriate place to post. I've been trying to research this topic on the web and haven't had much luck finding a workable solution.

I have a site written/hosted in HTML and I'm trying to write code to allow handhelds, PDA's and phones to be redirected to the mobile version of the site.

Since the main site is not written in .asp or .php apparently I don't have a lot of options. I'm told that using .htaccess it's possible to redirect but that's where I get lost.

Right now, you have to access the mobile version of the site by going to http://www.yourdomain.com/mobile and that's not good enough. I need some guidance to be able to redirect if possible.

Any suggestions?

Thanks!

~Mike~


Return to posts index
Reply   Like  

Curtis ThompsonRe: Redirecting to mobile website
by on Jul 9, 2008 at 8:13:24 pm

hello...

ya - you can use http rewrite rules, or you could use javascript, but the latter might not be as feasible because if they have js disabled on the pda, it won't catch. http rewrite happens on your server based on their user agent, though, so that would be much more reliable...

that said, as you can see from this list:

http://www.zytrax.com/tech/web/mobile_ids.html

there are quite a few user agents out there in mobile land. here's an example that finds iphone and itouch (as claimed by the author - by that i mean i'm not up on what the user agent is for these devices):

http://webdirect.no/mobile/apache-rewrite-rule-for-iphone-users/

basically you'll have to expand on that (if your isp allows you to use .htaccess files or overwrite this type of control - a lot might not, so you'll have to check with them)...what's happening here is all in the rewrite condition and rule - so to take an example from another blog:

RewriteCond %{HTTP_USER_AGENT} “Windows CE” [NC,OR] #Windows CE and Pocket PC
RewriteCond %{HTTP_USER_AGENT} “NetFront” [NC,OR] #PalmSource WebBrowser 2.0
RewriteCond %{HTTP_USER_AGENT} “Palm OS” [NC,OR] #Eudora Web Browser for Palm
RewriteCond %{HTTP_USER_AGENT} “Blazer” [NC,OR] #Handspring Blazer Browser
RewriteCond %{HTTP_USER_AGENT} “Elaine” [NC,OR] #RIM Devices
RewriteCond %{HTTP_USER_AGENT} “^WAP.*$” [NC,OR] #WAP Browsers
RewriteCond %{HTTP_USER_AGENT} “Plucker” [NC,OR] #Plucker Offline download client
RewriteCond %{HTTP_USER_AGENT} “AvantGo” [NC] #AvantGo Service
RewriteRule ^index.php http://www.yourdomain.net/pda.php [L,R]

basically if the browser's user agent matches one of these strings, then the rewrite rule kicks in...

it's not the most basic of concepts and rewrite stuff can be quite touchy, so it could be tricky to implement, but that's how you'd go about it...

hope that helps a bit!

sitruc







Return to posts index
Reply   Like  

mark cookmanRe: Redirecting to mobile website
by on Oct 30, 2008 at 5:55:23 pm

Heh thanks Curtis - whenever I have a query it seems you have posted an answer on it!
After finding (what I presume is your great work on) the mobi Cow site I am inspired to start "mobifying" my site too.
regards
Mark


Return to posts index
Reply   Like  


Curtis ThompsonRe: Redirecting to mobile website
by on Oct 30, 2008 at 6:04:11 pm

hello...

[mark cookman] "what I presume is your great work on"

actually not mine...but glad you like the cow feature!

always glad to help out when i can... :-)

sitruc





Return to posts index
Reply   Like  

mark cookmanRe: Redirecting to mobile website
by on Oct 31, 2008 at 12:41:27 pm

(heh I just sussed sitruc ....) I spent the night reading about mobi sites but didn't really get much hardcore XTML stuff.
Im planning to start off from scratch with a redirect.php and a print hello world; page.
may I ask you;

Whats a good place to lurk around to pick up knowledge to create an iPhone/Blackberry friendly video delivery section of my site?

I'm tempted to go for youtube (with all privacy settings on) but it seems such a cop out and there is probably a no commercial use blah in there somewhere.
cheers
M
.


Return to posts index
Reply   Like  

Don ManjRe: Redirecting to mobile website
by on Nov 17, 2008 at 1:14:42 am

I work for a design agency and we use a web service to detect mobile devices when they hit our client sites.

There are a few of them out there, but we have used handsetdetection.com most recently.


Return to posts index
Reply   Like  


Barry LatimerRe: Redirecting to mobile website
by on Feb 6, 2009 at 6:08:23 am

Hi,

Detecting a mobile phone browsing your website these days isn't that hard I have used a few different tools to do this

Here is an example in PHP
http://mobiforge.com/developing/story/lightweight-device-detection-php

Or there is a site called mobile elements(http://www.mobileelements.com) that has a simple webservice that tells you in the browser is a mobile phone or not quite easily



Return to posts index
Reply   Like  

idel fuschiniRe: Redirecting to mobile website
by on Mar 26, 2009 at 6:55:25 pm

Hi,
I suggest to see this project call "Apache Mobile Filter".

Here where you can doanload the software: http://sourceforge.net/projects/mobilefilter/

Here where you can see the documentation: http://www.idelfuschini.it/apache-mobile-filter.html



Return to posts index
Reply   Like  

idel fuschiniRe: Redirecting to mobile website
by on May 26, 2009 at 3:26:17 pm

I have published the new version of Apache Mobile Filter, now the filter is give to you the information of capabilities as apache environment.
Now you can develope in any language (php,jsp, ruby etc.) and have the information of mobile capability.


Read more info here: http://www.idelfuschini.it/it/apache-mobile-filter-v2x.html

Mobile Evangelist


Return to posts index
Reply   Like  


Alissa JanieceRe: Redirecting to mobile website
by on Nov 19, 2010 at 3:16:25 pm

I have a client where I am using a very simple javascript redirect:


<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->


Can I also use the .htaccess method in conjunction with the javascript for phones that do not have java enabled? Or do I have to use one or the other?


Return to posts index
Reply   Like  

Abraham ChaffinRe: Redirecting to mobile website
by on Nov 19, 2010 at 5:43:33 pm

The javascript method is not the best method to use. Better to do something server side, whether it's through .htaccess or a server side scripting language. Using a server side scripting language to redirect is the better method as it's easier to override and make exceptions to allow mobile users back to the main site if they choose.

There's a bit of best practices explained by Google on page 24 of this pdf LINK.

and here:
http://googlewebmastercentral.blogspot.com/2009/11/running-desktop-and-mobi...

Abraham


Return to posts index
Reply   Like  

Abraham ChaffinRe: Redirecting to mobile website
by on Dec 17, 2010 at 9:51:26 pm

There's a PHP mobile detection script that is pretty good here:
http://code.google.com/p/php-mobile-detect/

Abraham


Return to posts index
Reply   Like  


Deshmukh DavidRe: Redirecting to mobile website
by on Jul 23, 2009 at 3:07:14 pm

Best method of Redirecting your website to mobile website subdomain is shown on this link: http://www.deshmukhelectric.com/engineering
The website also contains files which you can simply download and upload to your website with minor changes.


Return to posts index
Reply   Like  

Mike LynnRe: Redirecting to mobile website
by on Jul 21, 2010 at 8:56:39 am

Here's an article I wrote which describes in detail how to accomplish mobile browser device detection and redirection.
Perl/CGI:
http://www.mlynn.org/2010/07/mobile-device-detection-and-redirection-with-p...
PHP:
http://www.mlynn.org/2010/06/mobile-device-detection-and-redirection-with-p...

I tend to avoid javascript because of the device limitations. These examples will show you how to accomplish detection and redirection without javascript. The code for the examples is freely available at the web site:
http://www.mlynn.org/wp-content/plugins/download-monitor/download.php?id=2

Enjoy!


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]