I wish to set a response header in .htaccess
but only when the site is loaded over HTTPS:
Header set MyHeader "%D %t" "%{HTTPS:on}"
# Error: Unknown parameter: %{HTTPS:on}
Header set MyHeader "%D %t" "expr=%{HTTPS:on}"
# Error: syntax error, unexpected $end: Function 'HTTPS' does not exist
Header set MyHeader "%D %t" "expr=%{HTTPS}==on"
# Error: syntax error, unexpected $end, expecting '('
HTTPS
is listed as a variable here
PS: I'm having a really hard time understanding how Apache expressions work so if anyone has come across a simple introduction with good examples, please share.
Use an
<If>
clause, it should work in.htaccess
:Reference:
http://httpd.apache.org/docs/2.4/mod/core.html#if