【发布时间】:2011-08-16 19:37:41
【问题描述】:
我当前的 URL 如下所示:'http://subdomain.domain.com/vanity/url'
当我尝试使用 PHP 获取此 URL 时:
$url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
var $url 持有这个:
'http://domain.com/index.php?var1=vanity&var2=url';
我想获取地址栏中的实际 URL。这可能吗?
【问题讨论】:
-
奇怪,
$_SERVER["REQUEST_URI"]应该保留原始的、未重写的 URL。$_SERVER["PHP_SELF"]将保存当前脚本的路径,无论是否重写。
标签: php url mod-rewrite