作者qm29213039 (崩啾)
看板PHP
標題[請益] CI抓不到controller裡面的檔案
時間Tue Jan 7 11:30:03 2014
各位版大好
我在首頁寫了一個按鈕
<button class="btn" type="button" onclick="self.location.href='/query'">查詢
</button>
我的認知上(我在其他OS上(XP,Win7)都可以正常運作)
按下按鈕應該會跳去controller去讀query.php
實際上會跳出錯誤訊息
Not Found
The requested URL /query was not found on this server.
Apache/2.2.8 (Win32) PHP/5.2.6 Server at localhost Port 80
印象中如果沒有抓到檔案的話應該會出現CI專屬的錯誤訊息
不太清楚為什麼會跑出瀏覽器的錯誤訊息
不知道方向去GOOGLE解答,可以請版大提供一些關鍵字嗎
附上OS版本: win8.1
Apache 2.2.8
補: 之前問過我一個同學
他要我去httpd.conf拿掉LoadModule rewrite_module modules/mod_rewrite.so的註解
可是還是一樣沒有辦法讀到query的檔案
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.124.3.163
※ 編輯: qm29213039 來自: 59.124.3.163 (01/07 11:33)
1F:→ MOONRAKER:你可以先用/index.php/query測看這樣有沒有 01/07 11:48
2F:→ MOONRAKER:如果有 檢查你CI根目錄下有沒有隱藏檔.htaccess 01/07 11:49
3F:→ MOONRAKER:你CI是不是沒有裝在host的根目錄 01/07 12:10
裝在appserv/www/下面
謝謝M大的水球,後來依照
http://goo.gl/SQv6uj 的說明
在主資料夾的下面新增.htaccess
把
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|robots\.txt|$)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
加入之後存檔就可以了 再次感謝M大
※ 編輯: qm29213039 來自: 59.124.3.163 (01/07 12:30)