Printing a Document Path Using SSI

I am currently trying to print the document path using SSI in Apache. I managed to get it to work, except that I first need to hardcode the "http: //" code. My current code:

You are currently here: <a href="http://<!--#echo var="HTTP_HOST" --><!--#echo var="REQUEST_URI" -->">http://<!--#echo var="HTTP_HOST" --><!--#echo var="REQUEST_URI" -->url.shtml</a>

      

The problem is that when I view this document via https, it still says "http" means it cannot link to itself.

Is there a way to do this without hardcoding to 'http: //'? I looked online, but most examples have done it this way.

Thanks.

+1


a source to share


1 answer


<!--#if expr="$SERVER_PORT = 80" -->
  <!--#set var="protocol" value="http" -->
<!--#elif expr="$SERVER_PORT = 443" -->
  <!--#set var="protocol" value="https" -->
<!--#endif -->

      



Then you can use <! - # echo var = "protocol" →

+1


a source







All Articles