mod_rewrite不工作 - 导致404错误,没有日志

时间:2014-12-08 02:23:21

标签: php apache .htaccess mod-rewrite

我正在我的Mac上运行localhost XAMPP并尝试使用mod_rewrite设置Apache服务器,这是.htaccess中的代码(位于htdocs中)

<IfModule mod_rewrite.c>

    RewriteEngine On                                        # Turn on the rewriting engine
    RewriteRule ^test/?$ api/rest/v1.0/api_controller.php?request=$1 [NOCASE,LAST]      # Handle requests for “test"

    RewriteLog "logs/rewritelog"
    RewriteLogLevel 7

</IfModule>

这是.htaccess文件中唯一的代码。

当我在浏览器中尝试使用我的链接http://localhost/test/1时,我只是被定向到404错误。

我在htdocs / logs / rewritelog下检查过,但是没有任何文件,甚至没有名为logs的文件夹。

更新

我正在运行Apache 2.4.10版本

1 个答案:

答案 0 :(得分:0)

事实证明.htaccess文件保存为.htaccess.txt,其中隐藏了.txt扩展名。如果您收到相同的错误,请在“获取信息”中查看该文件。

相关问题