CI 框架 隐藏index.php 入口文件 和 设置访问application下子目录

1、隐藏根目录下 index.php, 在根目录下创建 .htaccess文件

内容如下:

<IfModule mod_rewrite.c>

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

</IfModule>

2、CI框架 将后台程序放在application下的admin子文件夹下  不能访问图片、css等解决办法

在application目录下创建.htaccess 

内容如下:

<IfModule authz_core_module>

    Require all denied

    <FilesMatch "\.(images|js|css|jpeg|png|csv|gif)$">   //这下结尾的文件 可以访问

        Require all granted

    </FilesMatch>

</IfModule>

 

<IfModule !authz_core_module>

    Deny from all

</IfModule>

 

 

 

 

<IfModule authz_core_module>    Require all denied    <FilesMatch "\.(images|js|css|jpeg|png|csv|gif)$">        Require all granted    </FilesMatch></IfModule>
<IfModule !authz_core_module>    Deny from all</IfModule>

posted @ 2019-04-18 17:47  没事就更  阅读(819)  评论(0编辑  收藏  举报