Somehow I can't seem to get this right. I have a Stash variable that I'm setting if certain pages need to be redirected to their HTTPS version.

Tried it a number of ways, but very similar to this:

{if {exp:stash:not_empty name="secure" parse="inward" process="inline"} == 1 }
      {exp:dm_force_ssl:force parse="inward"}

This code resides in an embed btw (template partials approach, where the "secure" variable is set in the parent template partial, then the other variables are pushed into the wrapper). It ends up redirecting every page, not just the ones that fall into the conditional.

2 Answers 2


Ended up solving this with a combo of Switchee and Stash:

{exp:switchee variable="stash:secure" parse="inward"}
      {case value="y"}
      {case value=""}

Since Stash was used to set the "secure" variable, and Switchee is Stash-aware, you can just use the variable within Switchee.


Try a couple different iterations of the conditional:

{if "{exp:stash:not_empty name="secure" parse="inward" process="inline"}" == "1" }

{if '{exp:stash:not_empty name="secure" parse="inward" process="inline"}' == '1' }

{if "1" == "{exp:stash:not_empty name="secure" parse="inward" process="inline"}"}

{if '1' == '{exp:stash:not_empty name="secure" parse="inward" process="inline"}'}

Also, parse="inward" most likely isn't needed on the {exp:dm_force_ssl:force} tag.

  • Nadda. Kinda wondering if a header redirect is parsed before Stash even inits...
    – jpea
    Nov 14, 2013 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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