2014-12-08 66 views
0

我在我的Mac上运行本地主机XAMPP,并试图建立与mod_rewrite的Apache服务器,这是我在.htaccess代码(这是在htdocs目录)的mod_rewrite不工作 - 导致404错误,没有日志

<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的文件夹。

UPDATE

我运行的Apache 2.4.10版

+0

您没有匹配'/ test/1'的重写规则。也许尝试'^ test /(.*)$' – Phil 2014-12-08 02:26:32

+0

谢谢,但仍然没有运气 – 2014-12-08 02:28:51

+0

为什么没有日志的任何想法? – 2014-12-08 02:30:13

回答

0

因此,原来的.htaccess文件保存为.htaccess.txt其中.txt扩展名被隐藏。如果出现相同的错误,请在“获取信息”中检查文件。