I'm currently trying to print out a document path with SSI in Apache. I've managed to get it working, except that I have to hard code in the 'http://' at the beginning. My current code is:
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, when I view this document through https, it still says 'http' meaning it can't link to itself.
Is there any way I can do this without hard coding in the 'http://' ? I've looked online, but most examples have done it this way.
Thanks.
From stackoverflow
-
<!--#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" -->
Aaron Moodie : Thankyou! That's really cool. For some reason I didn't even think of using a if/else statement ... got a bit to learn about Apache yet ... :)
0 comments:
Post a Comment