CI框架学习之--隐藏入口文件-index.php
2017-07-08 19:13
746 查看
一般CI框架第一次使用时:
原地址为:
http://127.0.0.1/CI/index.php/hello/index
隐藏入口文件后只需要把地址写成即可:
http://127.0.0.1/CI/hello/index
1、需要开启Apache的 rewrite 功能
2、在入口文件同级目录(system/application同级目录)中,放入一个.htaccess 内容如下:
3、配置索引页 \application\config\config.php
原地址为:
http://127.0.0.1/CI/index.php/hello/index
隐藏入口文件后只需要把地址写成即可:
http://127.0.0.1/CI/hello/index
1、需要开启Apache的 rewrite 功能
Apache2.2\conf\httpd.conf修改如下:
修改前:
#LoadModule rewrite_module modules/mod_rewrite.so ... # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit AllowOverride None ...
修改成:
# 搜索 mod_rewrite 与 .htaccess 关键字来进行查询修改项 LoadModule rewrite_module modules/mod_rewrite.so <Directory "E:/ComTu_Design/PHP/Apache2.2/htdocs"> Options Indexes FollowSymLinks # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit AllowOverride all Order allow,deny Allow from all </Directory>
重启Apache.
2、在入口文件同级目录(system/application同级目录)中,放入一个.htaccess 内容如下:
(技巧如果自己编写创建一个点.开头的文件可以使用记事本另存为的方式输入双引号".htaccess"保存即可)
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
3、配置索引页 \application\config\config.php
原: $config['index_page'] = 'index.php';
修改成:$config['index_page'] = '';
相关文章推荐
- CI 框架怎么去掉隐藏入口文件 index.php
- CI框架学习笔记(二) -入口文件index.php
- CI框架学习笔记(二) -入口文件index.php
- CI 框架源码 入口文件 index.php 即程序开始执行的地方
- CI框架源码完全分析之入口文件index.php
- [PHP学习]TP5学习之Apache服务器隐藏index.php入口文件
- 【ci框架】单一入口文件index.php分析
- CI框架源码解读(1)-入口文件index.php
- CI 框架 入口文件 index.php 程序开始的地方
- CI框架源码解析一之入口文件index.php
- CodeIgniter框架源码学习之框架入口文件--index.php
- CI框架入口文件index.php文件分析 推荐
- Nginx配置 隐藏入口文件index.php
- CI框架学习之一 (入口文件解析)
- 隐藏了网站的入口文件index.php
- 教你如何在CI框架中使用 .htaccess 隐藏url中index.php
- CI框架源码学习笔记1——index.php
- ThinkPHP中通过URL重写隐藏应用的入口文件index.php的相关服务器的配置
- YII框架中php入口文件隐藏
- 隐藏了网站的入口文件INDEX.PHP