Latsu 发表于 2012-9-26 15:45:39

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

文件目录结构:


api
{
                application
   {
         controllers
         {
                yuehui {aaa.php}
                system{bbb.php}
                xxx.php
                yyy.php
         }
   }
                deploy
                doc
                system{系统文件}
}


Rewrite :


<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       
    </IfModule>
</Directory>


我现在访问 localhost/yuehui/aaa 成功,localhost/xxx 也成功,
但是访问 localhost/system/bbb 却反回错误,错误提示:

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 403rest.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文件夹名称, 怎么解决这个问题?

Latsu 发表于 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

kissgxd 发表于 2012-9-27 08:43:36

System下有自己的rewrite文件,这个阻止了你直接访问那个文件夹
页: [1]
查看完整版本: 使用API Rewrite与系统文件夹冲突,求解决.