开发者

Looking for SSI Environment Variable(s) for Document URL

I'm looking for an SSI Environment Variable that can return the Document URL...

http://www.mySite.com/path/myPage.html

Right now, I'm cobbling it together using these other environment variables...

<!--#echo var="SERVER_NAME" -->

gives this: http://www.mySite.com, and...

<!--#echo var="DOCUMENT_URI" -->

gives this: 开发者_如何学运维/path/myPage.html.

So I'm putting them both together, like this...

http://<!--#echo var="SERVER_NAME" --><!--#echo var="DOCUMENT_URI" -->

And it works just fine.

Two questions:

1) Is there a single SSI Environment Variable for the full Document URL? I've been searching for a while but cannot seem to find.

2) If not, can somebody explain why? There is one called HTTP_REFERER that returns the full URL of the referer, so why not one that returns the full URL of the current location, something like a DOCUMENT_URL?


1) No, there isn't. You can check this by a simple dump of all environment values:

<pre>
<!--#printenv -->
</pre>

2) Why? I'm not sure, perhaps because it would be redundant to have that in a single variable where you can cobble it together as you did. That and the fact that you might want to also do certain things like ignore the server protocol (HTTP or HTTPS) or use a different port, or any number of other reasons.

Hope that helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜