Trying to create the following redirect template for some structure pages, however the url is outputting like this http://example.com/{site_url}#section. Any idea why {site_url} variable isn't working? And/or any idea how to resolve issue. Thanks in advance.

{exp:channel:entries channel="pages"}
        header( "Location: {site_url}#{homepage_section}" );

1 Answer 1


You have PHP set to input on this template. That means that that something like:

    $test = "{site_url}";

Causes the template parsing engine to eval the raw PHP code before replacing {site_url} with the actual site URL. You need to set PHP to output for this template, which means that EE template tags get parsed FIRST, then it evals the PHP code, meaning the above will look like this by the time the raw PHP gets executed:

    $test = "http://www.domain.com";

Soooo yeah. FYI, if you have PHP on that template in other places, switching from input to output could definitely break things.


Wait.. so one EE tag is getting parsed, but the other isn't?

  • The templates are already set to output. And yes, the {homepage_section} variable is parsing, but not the global variable, {site_url}. Any idea?
    – frshjb373
    Commented Aug 27, 2015 at 15:26

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.