的.htaccess:GET变量都失去了改写 [英] .htaccess: GET variables are lost in rewrite
问题描述
很显然,我的.htaccess重写吞噬了所有的 $ _ GET
- 变量在我的网页:
Apparently, my .htaccess rewrite eats up all $_GET
-variables on my page:
在访问URL http://192.168.1.1/welcome/test?getvar=true 并运行的var_dump($ _ GET)
在我的index.php文件,我得到这样的输出:
When accessing the URL http://192.168.1.1/welcome/test?getvar=true and running var_dump($_GET)
in my index.php file, I get this this output:
array
'/welcome/test' => string '' (length=0)
因此,没有 $ _ GET
- 数据提供了 getvar
-Variable从我的网址迹象。
So no $_GET
-data available and no sign of the getvar
-variable from my URL.
下面是我的.htaccess:
Here's my .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
我应该改变,以确保我的改写正在如预期,但 $ _ GET
- 变量仍然可以访问?
What should I change to ensure that my rewrite is working as intended but $_GET
-variables still are accessible?
推荐答案
您需要在查询字符串添加选项:
You need the "QueryString Append" option:
重写规则^(。*)$的index.php?路径= / $ 1 [QSA,L]
编辑:添加@ DonSeba的贡献,因为它是正确的。
Added @DonSeba's contribution, because it is correct.
这篇关于的.htaccess:GET变量都失去了改写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!