1

I'm doing lots of checks against segments to try and perm redirect a very large list of old URLs and seem to have run into an issue with conditionals.

{if segment_1 == 'category' OR segment_1 == 'Category'}

Seems to always return true, even if segment_1 == 'sajdhjknsdjksad'. Is there a known bug, or am I doing something incredibly stupid?

UPDATE

The cause of the issue appears to be the redirect plugin I'm using getting evaluated before advanced conditionals, and then proceeding to redirect even if it shouldn't have actually been called. I'm using RedirectURL by Rodrigo Passos

6
  • Which version of EE are you using? Works for me in 253 and 255 Feb 6, 2013 at 9:23
  • Save yourself some heartache and prop up $20 for detour pro, 301 redirects in an instant Feb 6, 2013 at 9:27
  • Using 2.4.0, have some extensive custom plugins that aren't playing nice with 2.5.x and the client isn't keen on paying me to spend lots of time sorting it out Feb 6, 2013 at 9:44
  • Detour Pro is $22, works with 2.4 and you can add all redirects in literally minutes. If they're tight with $$, this is the smart move yeah ? Other then that, is there anything else going on in your template ? Feb 6, 2013 at 10:49
  • Just done some quick testing, think I've found the issue. The extension I'm using to make the redirect a 301 instead of a standard redirect is having it's template tag parsed before the conditional due to advanced conditionals doing crazy things for the template parsing order Feb 6, 2013 at 10:54

1 Answer 1

0

Per the comments, it appears this isn't a problem with your conditionals. It's a problem with the RedirectURL extension redirecting users before your page has finished parsing.

Generally in EE, all plugins/tags are parsed before conditionals are applied. A plugin which drastically alters the response (such as performing a redirect) should take this into account, and use an extension hook and some cunning to perform the redirect only after the template finishes parsing.

In this particular case, it's probably easier to find a different plugin to handle your redirects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.