用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2892|回复: 4
收起左侧

[HELP] 使用API Rewrite与系统文件夹冲突,求解决.

[复制链接]
发表于 2012-9-26 15:45:39 | 显示全部楼层 |阅读模式
文件目录结构:

PHP复制代码
 
api
{
                application
     {
           controllers
           {
                yuehui {aaa.php}
                system{bbb.php}
                xxx.php
                yyy.php
           }
     }
                deploy
                doc
                system{系统文件}
}
 
复制代码


Rewrite :

PHP复制代码
 
<Directory "/xampp/htdocs/api/">
    Options Indexes FollowSymLinks
    Order Allow,Deny
    Allow from all
    php_admin_value safe_mode On
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]      
    </IfModule>
</Directory>
 
复制代码


我现在访问 localhost/yuehui/aaa 成功,localhost/xxx 也成功,
但是访问 localhost/system/bbb 却反回错误,错误提示:
HTML复制代码
 
Access forbidden!      You don't have permission to access the requested directory.    There is either no index document or the directory is read-protected.  
If you think this is a server error, please contactthe webmaster.
Error 403  rest.shangbox.com
    09/26/12 15:26:49
  Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
复制代码


如果访问localhost/index.php/system/bbb 可以正常显示

我把system文件夹复制一份改成system2,再访问 localhost/system2/bbb 也是可以正常显示


请问是不是这个system跟系统文件system冲突 ?

别说我2B为什么起个system名字, 这个名字是我们项目经理起的, 我用的是XAMPP搭的环境...但是在他自己的机器上是可以用的,如果不修改controller下面的system文件夹名称, 怎么解决这个问题?

 楼主| 发表于 2012-9-26 15:52:06 | 显示全部楼层
项目经理说我用xampp环境Rewrite有问题, 让我换他的那个环境...物理吐槽了...我说他有强迫症...

跪求解决,跪求解决,跪求解决,跪求解决~~
发表于 2012-9-26 16:04:15 | 显示全部楼层
解决方法有的-
你把CodeIgniter的系统文件夹的名字改掉,或者不放在一级的目录里面
发表于 2012-9-26 16:38:46 | 显示全部楼层
官方这样解释
    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
发表于 2012-9-27 08:43:36 | 显示全部楼层
System下有自己的rewrite文件,这个阻止了你直接访问那个文件夹

本版积分规则