as I can if a condition is not met redirect


It is possible to perform a redirection with the template engine of twig I need to validate using a variable that I have, if the variable is not fulfilled redirect to /account/login

{% account.islogin==false%}

{#redireccion /account/login/
{% endif %}
asked by juan cruz 03.01.2019 в 20:32

1 answer


The redirection is done before entering the template, you have to use the php header function, to modify the "Location" header of the response http header("Location: $url_a_redireccionar");

answered by 03.01.2019 в 20:58