为什么我的 .htaccess 不起作用


Why is my .htaccess not working?

我有一个非常简单的htaccess,内容如下:

RewriteEngine On
RewriteRule ^([^/]*) /index.php?package=base&page=$1 [L]

它应与以下网址匹配:

http://apretaste.loc/developers

并像这样重写它:

http://apretaste.loc/index.php?package=base&page=developers

一切似乎都写得很好,但 .htaccess 正在重写为

http://apretaste.loc/index.php?package=base&page=index.php

我已经有几天了这个错误了...我做错了什么?另外,我使用 http://htaccess.madewithlove.be/检查了 htaccess,似乎重写正确。我在三个不同的服务器上测试了它...你能看到可疑的东西吗?

http://htaccess.madewithlove.be/表明

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*) /index.php?package=$1&page=$2 [L]

将重写

http://apretaste.loc/base/developers

http://apretaste.loc/index.php?package=base&page=developers

或者,为了回答原始问题,因此将:

RewriteEngine On
RewriteRule ^[^/]*/(.*)$ /index.php?package=base&page=$1 [L]