2014-12-08 67 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擴展名被隱藏。如果出現相同的錯誤,請在「獲取信息」中檢查文件。