2015-11-20 66 views
0

我創建了一個共享服務器的的.htaccess文件一個叫API這是根文件夾的子文件夾內。的.htaccess mod_rewrite的簡單發送404錯誤

我放在下面的簡單代碼的文件

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase /API/ # also tested with/alone (edit) also tested removing-it 

RewriteRule ^/API/(\d+)*$ /API/index.php?i=$1 

我的意圖是把/API/{var}/API/index.php?i={var}內部,但訣竅是不工作的。什麼可以導致這個問題,因爲每個查詢變量我發送到。

什麼可能導致問題?我應該從哪裏開始調試?

編輯: 經過多次失敗的嘗試,我會嘗試使用the FastRoute php library作爲替代,因爲這的.htaccess問題似乎無法解決的。

感謝Félix對聊天中的所有幫助。

回答

0

的問題可能是斜線/API在你重寫格局,從那裏

嘗試刪除它們:

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase /API/ 
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^(\d+)*$ /API/index.php?i=$1 [NC,L]