{site_url} global variable not outputting in php header redirect

By | August 26, 2015

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}" );