Apache 从$\u服务器-php检索修改后的请求URL
当浏览器请求以下url时Apache 从$\u服务器-php检索修改后的请求URL,apache,.htaccess,Apache,.htaccess,当浏览器请求以下url时 http://test.localhost/mobile.html?page=online&option=test&_ga=2.145898866.737559230.1531785796-1355088823.1529293502 htaccess文件规则 RewriteRule ^(.*)\.html$ index.php?page=$1 将URL修改为 http://test.localhost/index.php?page=mobile 在index.php文
http://test.localhost/mobile.html?page=online&option=test&_ga=2.145898866.737559230.1531785796-1355088823.1529293502
htaccess文件规则
RewriteRule ^(.*)\.html$ index.php?page=$1
将URL修改为
http://test.localhost/index.php?page=mobile
在index.php文件中,包含以下echo语句
echo "Request URI:" . $_SERVER['REQUEST_URI'] . "<br/>";
echo "Query String:" . $_SERVER['QUERY_STRING'] . "<br/>";
echo“请求URI:”$_服务器['REQUEST_URI']。“
”;
echo“查询字符串:”$_服务器['QUERY_STRING']。“
”;
它显示以下输出
请求URI:
http://test.localhost/order-online/order.html?_ga=7.145874566.73777770.1531785796-135578823.152927502
查询字符串:page=mobile
请求URI显示原始请求,如何获取重写的请求URI
http://test.localhost/index.php?page=mobile
在PHP代码中,您可以使用此代码获得重写的URI:
$uri = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
不清楚你在问什么?是否希望所有请求都变成
http://test.localhost/index.php?page=mobile
?或者所有具有查询字符串page=online&option=test&u-ga=2.145898866.737559230.1531785796-1355088823.1529293502
的请求都应该成为该URI?还有,orders.epicpizza.com.au
与任何事情都有什么关系?要回显重写的htaccess url是否存在任何$\u服务器参数来显示重写的url?