ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

iPhone redirection

October 22, 2010 5:57pm

Subscribe [2]
  • #1 / Oct 22, 2010 5:57pm

    stubear

    114 posts

    I tried to implement the is iPhone? plug-in but I keep getting an error,

    Cannot Open Page
    Safari cannot open the page because too many redirects occurred.

    Thinking it might be the plug-in I gave Platform Redirector a shot but had the same results.  Sticking with Platform Redirector I changed the URL to http://www.expressionengine.com and the redirect worked.

    My setup is fairly simple.  On the index page I have the following code:

    {exp:platform_reedirect platform="iPhone" redirect="iphone/index" mobile="yes"}

    I also tried to redirect the page using Platform Redirector and platform=“Firefox” with similar results (the page didn’t load, an error page came up instead).

    This points to a very basic html page with nothing but standard html tags on it, no EE or PHP at all.

    Has anyone used any of these plug-ins and how did you get them to work?

  • #2 / Oct 22, 2010 6:13pm

    Jamie Poitra

    409 posts

    The issue is just like it sounds.  Your redirection is looping infinitely and so the web server gives up.

    Is that plugin in the mobile pages too?  That’s the most likely reason.

    Jamie

  • #3 / Oct 22, 2010 6:45pm

    stubear

    114 posts

    I guessed that much. As for the plug-in, that code is only on the first page. The redirect link, so far, is a very basic html page with no EE tags or other dynamic content whatsoever.

  • #4 / Oct 22, 2010 7:09pm

    Jamie Poitra

    409 posts

    Hmm, then it would seem it’s not actually sending you to the page you expect it to.

    Looking at the Redirect plugin code it’s pretty straightforward. 

    I’d open it up and add this:

    **EDIT** Forgot to add an exit(); after the print_r.

    print_r($this->EE->functions->fetch_site_index(1, 0).$redirect); exit();

    Right above both of the lines that look like this:

    $this->EE->functions->redirect($this->EE->functions->fetch_site_index(1, 0).$redirect);

    Then try visiting the site on your iPhone and see what it spits out.  Is it the page you were expecting or is something in the URL goofed up?

    Jamie

  • #5 / Oct 22, 2010 7:10pm

    Jamie Poitra

    409 posts

    Also what happens if you go to that simple page WITHOUT the redirection?

    Jamie

  • #6 / Oct 25, 2010 10:52am

    stubear

    114 posts

    Surprisingly it turned out to be an issue with the way the redirect page was created.  All but the very first page were created without the use of the CP but for some reason the redirect plug-ins I tied don’t want to redirect to a page not created in the CP (you can edit and save it using your favorite text editor, you just have to create it in the CP).  Very weird but problem solved, mystery still remains.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases