作者arthas1107 (az)
看板PHP
标题[请益]CodeIgniter 开启mod_rewrite失败
时间Fri Jul 15 18:14:36 2016
已爬文但仍然无法解决,只好再发一篇请大家帮忙
环境
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://webptt.com/cn.aspx?n=bbs/PHP/M.1468577678.A.3F3.html
1F:→ MOONRAKER: 如果你确定找到的方法都做了 检查.htaccess的换行字元07/15 21:06
2F:→ MOONRAKER: 不可以CRLF 要转成LF07/15 21:07
→ MOONRAKERm: Sorry 没看到在win10下 那恐怕跟CRLF没关联 07/15 21:08
3F:推 ns1234: W10..真酷07/15 21:10
4F:推 ns1234: 照错误讯息看是 是权限问题 apache 不能访问 test资料夹?07/15 21:14
5F:→ ns1234: 根目录下的index.php 能开吗07/15 21:15
在网址里加上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
6F:推 ns1234: 不负责任猜测是少了一个 "." ,变成导到硬碟的"/test/index 07/16 02:06
7F:→ ns1234: 应该是要导到 /var/www/html/test/index.php 之类的 07/16 02:07
8F:推 ns1234: 查了一下我的猜测应该是错的 别理我.. 07/16 02:22
9F:推 ns1234: 另外想问一下 CI有3 不直接 从3开始吗XD 07/16 02:27
10F:→ AkiHito: 这是用sub folder的? 07/16 07:11
因为是抓范例来研究的,提供者是用2,刚刚测试确实是权限问题
改成Options FollowSymLinks就可以了,感谢大家提供意见
※ 编辑: arthas1107 (118.232.112.210), 07/16/2016 15:39:32