Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    Yes this is possible. Try:

    if(is_ie() && get_browser_version() <= 8) {
       wp_redirect('https://www.example.com', 301);
       exit;
    }

    Change “https://www.example.com&#8221; to whatever URL / page you want IE8 and lower people to go to.

    Thread Starter drezstreat

    (@drezstreat)

    Heh thanks works perfect.

    Hi there. I’d actually like to do this exact same redirect for our entire site, and am unsure where to add this code to my theme?

    I’ve tried it both in the <head> tag of my theme’s header.php file, and also in functions.php. But with both attempts, when testing in IE 8, nothing happened.

    Can you tell me where it’s best to put this code to apply to all site pages (going to one redirect)?

    Many thanks.

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    You should probably put this code at the very top of your header.php file, before anything else, even the <HTML> tag:

    <?php
    // redirect IE8 and lower visitors
    if(is_ie() && get_browser_version() <= 8) {
       wp_redirect('https://www.example.com', 301);
       exit;
    }
    ?>

    Thanks so much for the quick response!

    I have added this as the first line to my theme’s header.php file, and it is not redirecting when I test on IE8 (any/all pages in https://bigmoves.org/staging/ ).

    I also tried attaching it to routine functions in functions.php, and also giving it its own unique function name and calling that in header.php. Nothing seems to make a redirect work here… this is a single site install.

    (And yep, PHP Browser Detection is definitely installed and activated.)

    Because it’s a responsive site, there is an html5 detection script in place looking for older than IE9 so as to run html5shiv, do you think that is interfering?

    <!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

    Many thanks again.

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    If you want to send me a temporary admin login for the site I can check it out (info AT mindsharestudios DOT com).

    That’s generous of you, if you have a minute. Just sent the info. Thanks!

    I used the exact redirect code that you posted and it technically works but it takes forever to load for some reason. I am using a child them and have it in my modified header file within my child theme. When I add it to the parent theme header file the redirect doesn’t work at all. If i set it to an external page like google.com or something it works fine but when I link to a page within my site (what I’m trying to do) it is painfully slow. Any help would be appreciated.

    Cheers

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    @slshaw115 You probably have created a redirect loop.

    You need to make sure wp_redirect doesn’t get called on the page you are redirecting to, otherwise it will keep redirecting over and over until the server stops the loop.

    That makes sense. I’m just not sure where to put it other than in the header.php file to avoid this issue.

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    You would need to add some sort of test to see if the person is already on the redirect page. Try something like this:

    if(is_ie() && get_browser_version() < 9 && !is_page('please-update-your-browser')) {
       wp_redirect('/please-update-your-browser/', 301);
       exit;
    }

    You would need to replace “please-update-your-browser” with the slug or name of the page your are redirecting to.

    No luck. Not sure why because that appears to me like the proper way to do it. I’ll have to keep messing with it. Thanks so much for your help.

    Cheers

    John

    (@johncpatterson)

    Hello, I have been attempting to do exactly what the author of this post has been attempting to do, which is redirect just one of my WordPress pages for mobile users, however I have gotten stuck. This is the code I’m using so far:

    <?php
    if ( is_mobile() && get_the_ID(2766) ) {
    wp_redirect(‘https://www.lifebyjohn.com/mobile-schedule&#8217;);
    exit;}
    ?>

    I tried adding the code in header.php, as well as using the Code Snippets plugin so that it would go in functions.php. Did I mess the code up by chance? Or am I putting the code in the wrong place? I’m a relative newbie so patience with me would be appreciated ??

    Thanks!

    @john – this thread is 5 months old and already marked resolved. Please start your own thread if you need help with this plugin.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘How to Redirect?’ is closed to new replies.