[請益]CodeIgniter 開啟mod_rewrite失敗

看板PHP作者 (az)時間9年前 (2016/07/15 18:14), 9年前編輯推噓5(505)
留言10則, 3人參與, 最新討論串1/3 (看更多)
已爬文但仍然無法解決,只好再發一篇請大家幫忙 環境 Win10 apache 2.4.20 x86 php 5.6.22 x86 CI2.1.2 架構 WWW /test /index.php、.htaccess、system、application... 修改項目 apache-httpd.conf 155行 LoadModule rewrite_module modules/mod_rewrite.so 刪除註解 226行 <Directory /> AllowOverride All Require all denied </Directory> 244行 <Directory "d:/www"> Options MultiViews AllowOverride All Require all granted </Directory> ci-conf $config['index_page'] = ''; .htaccess內容 RewriteEngine On RewriteBase /test RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] 網路上查到的做法大都試過了,但是仍出現錯誤訊息 Forbidden You don't have permission to access /test/index.php on this server. 麻煩大家看一下我有哪邊做錯了,感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.232.112.210 ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1468577678.A.3F3.html

07/15 21:06, , 1F
如果你確定找到的方法都做了 檢查.htaccess的換行字元
07/15 21:06, 1F

07/15 21:07, , 2F
不可以CRLF 要轉成LF
07/15 21:07, 2F
MOONRAKERm: Sorry 沒看到在win10下 那恐怕跟CRLF沒關聯 07/15 21:08

07/15 21:10, , 3F
W10..真酷
07/15 21:10, 3F

07/15 21:14, , 4F
照錯誤訊息看是 是權限問題 apache 不能訪問 test資料夾?
07/15 21:14, 4F

07/15 21:15, , 5F
根目錄下的index.php 能開嗎
07/15 21:15, 5F
在網址裡加上index.php就正常顯示,但是拿掉就會出現沒有權限的訊息,會是Options MultiViews這設定問題嗎? ※ 編輯: arthas1107 (118.171.135.62), 07/15/2016 22:36:07 ※ 編輯: arthas1107 (118.171.135.62), 07/15/2016 22:37:41

07/16 02:06, , 6F
不負責任猜測是少了一個 "." ,變成導到硬碟的"/test/index
07/16 02:06, 6F

07/16 02:07, , 7F
應該是要導到 /var/www/html/test/index.php 之類的
07/16 02:07, 7F

07/16 02:22, , 8F
查了一下我的猜測應該是錯的 別理我..
07/16 02:22, 8F

07/16 02:27, , 9F
另外想問一下 CI有3 不直接 從3開始嗎XD
07/16 02:27, 9F

07/16 07:11, , 10F
這是用sub folder的?
07/16 07:11, 10F
因為是抓範例來研究的,提供者是用2,剛剛測試確實是權限問題 改成Options FollowSymLinks就可以了,感謝大家提供意見 ※ 編輯: arthas1107 (118.232.112.210), 07/16/2016 15:39:32
文章代碼(AID): #1NYBUEFp (PHP)
文章代碼(AID): #1NYBUEFp (PHP)