Results 1 to 4 of 4

Thread: Auto redirect to mobile site

  1. #1
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Auto redirect to mobile site

    I need to redirect mobile devices to the mobile version of my site. How can I do this in Contao? I have a script which detects mobiles then redirects them using:
    Code:
    header('Location: ../mobile');
    I have included this script at the top of my template file but this gives me an error when accessed with an iPhone that says "Too many redirects". If I redirect the script to an external URL it works fine, but this is no use to me as my mobile site is under the same domain as my main site.

    Thanks

  2. #2
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Auto redirect to mobile site

    Did you try using an absolute URL instead?

    Also, make sure your redirect code isn't accidentally in the mobile site templates.
    Brian

  3. #3
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: Auto redirect to mobile site

    Thanks for the reply. Yes you were right, I was using different layouts but both layouts were using the same template. I gave the mobile site a separate template, took out the redirect script and it's all working now.

  4. #4
    User
    Join Date
    01-20-11.
    Location
    Germany
    Posts
    77

    Default Re: Auto redirect to mobile site

    Hello,

    you might also use the redirect extension to do this. It also offers a cookie check so that you can offer your visitors the chance to switch back to the normal version of the web page.

    Jan
    Free support only here in the forum.
    Please report bugs for my extensions using http://www.contao-forge.org. Thanks!
    Requests for Contao support and development please send mail to jan@theofel.de

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •