How To Redirect To Your Mobile Website

In this section we'll cover how to:

  1. Automatically redirect mobile users to your mobile website
  2. Allow mobile users to View the Full Website
  3. Direct a .mobi to your mobile website

The Redirect Code

Quick Instructions!

Copy this code, and paste it in the head code of your homepage (index.html). This will automatically redirect mobile devices to your mobile website. For detailed instructions, read the Step by Step Instructions...

<script>
if (document.location.search.indexOf("skipmobile") >= 0) {
document.cookie = "skipmobile=1";
}
else if ((document.location.hostname.match(/\.mobi$/) || screen.width < 699)
&& document.cookie.indexOf("skipmobile") == -1)
{
document.location = "mobile/";
}
</script>

This code does 3 things:1. Redirects mobile users to your mobile site. 2. Allows mobile users to go back to the full site if desired. 3.Redirects domain names ending in .mobito the mobile version of your site.


Step by Step Instructions

1. Open Page Builder



2. Click Edit Homepage

Open your Homepage (index.html).


3. Go to Your Page Options

Click File >Page Options


4. Paste the Redirect Code into the head code

In the Page options there is a box labeled Head Code. Paste the redirect code into the head code.


5. Save

Click File > Save


6. Test

If you have a smart phone or other mobile device, go to your website and test to see if it works. If you have problems, read the Trouble Shooting Section.


Trouble Shooting

Pay attention to your directory name. The folder name should be called mobile and the page should be called index.html. It should be all lower case.

If your folder name is something other than mobile, don't worry! We can still make it work. You just have to change a small piece of code:

<script>
if (document.location.search.indexOf("skipmobile") >= 0) {
document.cookie = "skipmobile=1";
}
else if ((document.location.hostname.match(/\.mobi$/) || screen.width < 699)
&& document.cookie.indexOf("skipmobile") == -1)
{
document.location = "mobile/";
}
</script>

Change mobile/ to whatever you named your mobile folder.
For example document.location = "mymobilewebsite/";




Let Visitors Go back to the Main Site

It's good practice to give visitors the option to go back to your main website. Generally your full website will have more information and features than the mobile version. Giving visitors the option to transverse the two will win you points in many people's eyes. Here's how to do it...

1. Open Your Mobile Webpage in PageBuilder

Click File >Open. Then select the folder mobile >index.html



2. Create a Title block Near the top

Click the Add button in the top-right corner of the screen. Then click Next Step.


3. Add Special Link

In the text area type "View Full Site". Then in the url area, type your website address (ie. http://www.MyWebsite.com) and then put ?skipmobile=1 at the end ( ie. http://www.MyWebsite.com/?skipmobile=1 ). Push Submit.


Explanation: If you redirect users to your mobile site, and then put a link back to the main site, you'll have a problem. They will automatically be sent back to the mobile site (making it impossible for mobile users to view the full site), but the redirect code we've written has a special feature that looks for the words ?skipmobile=1 before it redirects you. so if you include it in your link they won't be sent back to the mobile website.

4. Save

Save your page. You're done! You should now have a text link near the top of your page that says "View Full Site". When a mobile user wants to get back to the full website, they now have the power to do so.






Direct a .mobi to your mobile site.

Like .com or .net, .mobi is part of a web address. You can buy a .mobi domain name from us, or from another domain name seller. If you purchase from another domain name seller, additional setup is required.

If you've purchased your .mobi, from EZ-NetTools, The Redirect Code at the top of this page will automatically redirect your .mobi to your site.

Buy a Domain Name

A Better Way to Redirect

Better SEO. Faster Redirect Speed. To help you save money, we provided the above code with an .mobi redirect script which will automatically redirect your .mobi domain name to your mobile site. However, there is a more efficient way to point your mobi domain name to your mobile website.

For $45.00 our system administrator can directly point your .mobi to the mobile version of your site. This means that when someone types in YourWebsite.mobi it will take them directly to the mobile website (instead of going to the main site first, and then forwarding them to the mobile version). This improves your search engine optimization, and speeds up the process for your users. If you can spare the 45 bucks, this is the recommended way of pointing your domain name to your mobile site.