这是URL我要求:无法获取点查询字符串
localhost/register... // with dotes at the end
尝试使用$_GET
获得URI时:
echo $_GET['uri'];
它返回register
。
我只有2个文件: .htaccess文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ home.php?uri=$1 [L,NC,QSA]
和home.php:
<?php
echo $_GET['uri'];
?>
我怎样才能得到准确的查询字符串?
编辑: 它工作时的URL是这样的:
localhost/home.php?uri=register.. // returns register..
但不工作的时候网址是这样的:
localhost/register... // returns register
你的例子适合我。 Debian:谷歌浏览器版本46.0.2490.80(64位)和Mozilla Firefox 46.0a1 Apache/2.2.22,PHP/5.4.45-0 + deb7u2。你的环境是什么? – Progrock
也许你的网络浏览器试图做一些文件夹遍历和剥离点。尝试其他浏览器。 – Progrock
Apache/2.4.7(Win32)OpenSSL/1.0.1e PHP/5.6.17 Firefox 44 也尝试使用chrome – AliN11