查找文档 URL 的 SSI 环境变量
我正在寻找一个可以返回文档 URL 的 SSI 环境变量...
http://www.mySite.com/path/myPage.html
现在,我正在使用这些其他环境变量将其拼凑在一起...
<!--#echo var="SERVER_NAME" -->
给出以下内容:http://www.mySite.com
,并且...
<!--#echo var="DOCUMENT_URI" -->
给出:/path/myPage.html
。
所以我把它们放在一起,就像这样......
http://<!--#echo var="SERVER_NAME" --><!--#echo var="DOCUMENT_URI" -->
而且效果很好。
两个问题:
1) 完整文档 URL 是否有一个 SSI 环境变量?我已经寻找了一段时间但似乎找不到。
2)如果没有,有人可以解释为什么吗?有一个名为 HTTP_REFERER
的方法可以返回引用者的完整 URL,那么为什么不返回当前位置的完整 URL(例如 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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1)不,没有。您可以通过所有环境值的简单转储来检查这一点:
2)为什么?我不确定,也许是因为将其放在单个变量中是多余的,您可以像以前一样将其拼凑在一起。事实上,您可能还想做某些事情,例如忽略服务器协议(HTTP 或 HTTPS)或使用不同的端口,或任何其他原因。
希望有帮助
1) No, there isn't. You can check this by a simple dump of all environment values:
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