使用mod_rewrite后如何检索 GET 数据



我的.htaccess中有以下代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>

但是现在,_GET美元的语句不起作用。 如果我有一个网址http://localhost/home/index?var=3,$_GET 只包含值"主页/索引"。 我不熟悉这个,所以我不知道如何改变它。

如何在我的 URL 中启用 $_GET 语句?

更改:RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

RewriteRule ^(.*)$ index.php?url=$1 [PT,L,QSA]

它现在将追加查询字符串。 QSA意味着Query String Append

最新更新