Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 24th May 2012, 11:18 AM   #1
Warrior Member
 
Join Date: 2011
Location: Pensacola, FL.
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default
Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

I created a mobile site for my website, but I can't seem to redirect the domain to show my mobile site on my cellphone instead of the original site? Right now, I have my main site called 'index' and my mobile site called 'app,' and all my mobile site is 1 html file and a css file.
OrenPowell is offline  
Unread 24th May 2012, 12:07 PM   #2
Advanced Warrior
War Room Member
 
Brandon Tanner's Avatar
 
Join Date: 2006
Location: USA
Posts: 1,907
Thanks: 237
Thanked 1,377 Times in 676 Posts
Default
Re: Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

What kind of redirection script are you using? And what's the URL?


Brandon Tanner is offline  
Unread 24th May 2012, 12:12 PM   #3
Warrior Member
 
Join Date: 2011
Location: Pensacola, FL.
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default
Re: Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

Not using any, That's what I need to know. I was told you need to add a coding into your index file to check the browser the person is using to see if it needs to redirect the person to the mobile address or keep them on the main site. Question is, what is that coding or if that's even true?
Thanks,
OrenPowell is offline  
Unread 24th May 2012, 01:02 PM   #4
Warrior Member
 
Join Date: 2012
Posts: 8
Thanks: 2
Thanked 1 Time in 1 Post
Default
Re: Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

Do a search for "mobile redirect script" and you should see code that will be something like ...<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}

It will load your mobile page that you put in for "mobile.html" instead of your index page after determining the screen width.

I'm sure someone else here can probably explain this better but that's basically what you need to insert on your index page.
griffin82 is offline  
Unread 24th May 2012, 01:09 PM   #5
Advanced Warrior
War Room Member
 
Brandon Tanner's Avatar
 
Join Date: 2006
Location: USA
Posts: 1,907
Thanks: 237
Thanked 1,377 Times in 676 Posts
Default
Re: Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

Yeah, you need a script that redirects the users based on either A) their device screen width, or B) the "user agent" (which is a device-specific redirection).

This is usually done in Javascript or PHP, but can also be done via htacess.

The simplest way is to use a Javascript redirection based on screen width. For example...

Code:
<script type = "text/javascript">
<!--
if (screen.width < 1024)
{document.location = "mobile_site.html";}
-->
</script>
That method works pretty well overall, but it's not perfect (there are a few mobile devices out there that it won't properly redirect).

So if you need "perfect", then you'll need to go with "user agent" based redirection, which can be a pain if you do it yourself (because you have to keep updating it whenever new mobile devices come out). But there's tons of pre-existing scripts and services out there specifically for this. Just Google "mobile redirection script".


Brandon Tanner is offline  
Unread 24th May 2012, 02:18 PM   #6
Web Developer
War Room Member
 
Andrew H's Avatar
 
Join Date: 2012
Location: Vancouver, BC
Posts: 593
Thanks: 149
Thanked 162 Times in 133 Posts
Default
Re: Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

Detect Mobile Browsers - Open source mobile phone detection

"You shouldn't come here and set yourself up as the resident wizard of oz."
Andrew H is offline  
Unread 25th May 2012, 07:31 AM   #7
brickandmobile.com
War Room Member
 
Kevin Z's Avatar
 
Join Date: 2010
Location: Toronto
Posts: 309
Thanks: 60
Thanked 106 Times in 64 Posts
Default
Re: Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

There are some great Mobile Redirect scripts you can find. If you are using Wordpress there are a number of plugins you can use that will accomplish that you are trying to do.

[
brick&mobile
Click here to start your
Mobile Marketing business
Kevin Z is offline  
Unread 25th May 2012, 08:05 AM   #8
Digital Marketer
War Room Member
 
WillR's Avatar
 
Join Date: 2010
Location: Australia
Posts: 12,475
Thanks: 1,984
Thanked 8,187 Times in 4,079 Posts
Default
Re: Redirecting Main site to Mobile Site
Share on: 
fb share twitter share gplus share more share

Yes it's true you need a redirect script in place otherwise it will not work. As others have mentioned above there are several options for you when choosing a mobile redirect script. You can use screen size detection or user agent detection. Screen size detection basically looks at the width of the screen viewing your website and if it's below a certain width (ie - a mobile device) that person will be redirected to the mobile website you specify. User agent detection looks for the type of device and/or mobile browser viewing the website. When they detect a mobile device or mobile browser the user will automatically be sent to the mobile website you specify.

Each option has it's own advantages and disadvantages. Screen width detection is what I have always used up until now and it's always worked quite well. The only problem with screen width detection is that some newer devices have screen resolutions the same size as desktop PC's so they will not be picked up by the redirect script.

The disadvantage with user agent detection is that you must specify each and every user agent meaning everytime a new mobile device or mobile browser is released, you need to update your redirect code accordingly. So it's not really set and forget.

If I were you I would just start out with the simple screen width detection script posted in post#5 above. Copy and paste that right into your main websites homepage anywhere above the closing head tag </head>.

Make sure to specify the address of your mobile website in that script. The only other thing I would do is change the 1024 value to 1023. There are still a LOT of dekstop PC's that have a screen width of 1024 pixels so if you leave it at that value a lot of your desktop computer viewers will end up being redirected to your mobile site which is not what you want.

WillR is offline  
The Following User Says Thank You to WillR For This Useful Post:
Closed Thread


Bookmarks

Tags
main, mobile, phone, redirect, redirecting, site, web


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 03:56 AM.