URL重写 - $ _GET变量不通过

时间:2014-01-15 16:58:33

标签: php apache .htaccess mod-rewrite rewrite

我有一个简单的重写改变

http://website.com/page.php?id=1

进入

http://website.com/page/1

使用以下重写

RewriteRule ^page/(\d+)/?$ /page.php?id=$1 [L]

重写有效,它显示页面(我没有得到404),但它似乎没有从URL传递id。

为了测试这个我基本上回应了$ _GET ['id']并且没有返回任何内容。

有谁知道我为什么会出错?

非常感谢

1 个答案:

答案 0 :(得分:7)

这很可能是因为MultiViews启用了mod_rewrite之前运行并重写/page to /page.php

在.htaccess上添加此行以禁用它:

Options -MultiViews
相关问题