Using only server side includes, I'd like to display the full URL at the bottom of each web page. I'd like to include http
or https
depending on the connection. I've verified that
<!--#echo var="SERVER_PORT" -->
shows 80 for http and 443 for https.
I've tried a number of variations of the following, but neither statement displays a URL:
<!--#if expr="\"$SERVER_PORT\" = \"80\"" -->
http://<!--#echo var="SERVER_NAME"--><!--#echo var="DOCUMENT_URI"-->
<!--#endif -->
<!--#if expr="\"$SERVER_PORT\" = \"443\"" -->
https://<!--#echo var="SERVER_NAME"--><!--#echo var="DOCUMENT_URI"-->
<!--#endif -->
I'm not using <!--#elif -->
simply for testing purposes. Neither of the above gives an SSI processing error, but then again neither condition is met.
Googling has revealed lots of permutations but all the ones I've tried result in errors processing the directive.
Finally found an answer:
<!--#if expr="%{SERVER_PORT} eq 80" -->