Support » Plugins » Hacks » Can I get a little help on this code snippet?

  • I am trying to get a message displayed after being 301 redirected from an old site. I was given this PHP snippet to use along with adding “?redirect=true” to the redirect in .htaccess.

    However the following code is returning a Parse error, and I’m not savvy enough to troubleshoot it. I am smart enough to put <?php and ?> before and after the code though.

    Little help? Thannks!

    if(isset($_GET['redirect')){
    
     if($_GET['redirect'] == 'true'){
    
     ?><div class='redirected'>You were redirected!</div><?
    
     }
    
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • the code seems to be missing a square closing bracket:

    if(isset($_GET['redirect'])){

    if this is not all then change the php shorttag to:

    ..... redirected!</div><?php

    alchymyth!
    That totally fixed it!!!

    Now the only issue I have is that adding ?redirect=true to the end of the urls makes it so that may exact match urls don’t work.

    If I have A.com/blogpost21 I’d like to go to B.com/blogpost21.
    But with this script I get b.com/?redirect=trueblogpost21.
    And since that’s not a real page it displays the first page.

    I know you weren’t expecting that can of worms… Ha! Any idea of where i could go from there? Or maybe I should post a new thread…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can I get a little help on this code snippet?’ is closed to new replies.