Jump to content

Need help with a redirect for mobile


Slimster

Recommended Posts

Hoping someone can help me i know very little about php anyways i am trying to get this to work on my eccommerce site which is all in php. Here is the instructions i have i did upload the files all i need help with is where to put the single line of code for the redirect.

 

Installation

 

  1. Create a subdomain on your server called 'm'. (Ex: m.example.com)

          * Depending on what kind of hosting you have, the procedure to do this may be either editing configuration files and restarting the server, accessing a control panel, or having a system administrator set it up.

  2. Upload the files from the 'm' directory to the document root for your new subdomain.

  3. Your mobile site is working! Just visit your m subdomain to see it.

 

 

Setting up auto redirect

 

If your website is in PHP, you can use phpMobilizer to set up automatic redirection to your mobile site for mobile devices.

 

  1. First you will need to determine where to place the redirect code. Usually you would want to place it in a common include file, such as a config file, a database connection file or a header file.

  2. Add the following line of code before any html or text output.

          * require_once('/home/path/to/subdomain/m/mobilize.php');

          * Edit the path so it is pointing directly to the mobilize.php file, which will be in the subdomain's document root.

  3. Visit your website with a mobile device and verify it redirects you!

 

Link to comment
Share on other sites

My problem is i do not know where to put the line of code on my site i tried it on the header.php and a few other pages but it keeps showing the code on top of my site when i open it in a browser. Now should it be put on top before everything and should it be in php tags.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.