CI框架路由去掉index.php
2017-01-04 10:12
344 查看
apache去掉index.php
1.编辑conf/httpd.conf配置文件
#LoadModule rewrite_module modules/mod_rewrite.so 把该行前的#去掉
同时对应Directory下要配置 AllowOverride All
2.在 CI 根目录下(即在index.php,system的同级目录下)新建立一个配置文件,命名为: .htaccess 内容如下:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(application|modules|plugins|system|themes) index.php/$1 [L]
3.把system/application/config/config.php 中$config['index_page'] = "index.php";改为$config['index_page'] = "";
4.重启apache
nginx去掉index.php
1.编辑nginx.conf文件
vi /usr/local/xxxxx/nginx/conf/nginx.conf
#nginx去掉index.php
location / {
rewrite ^/$ /index.php last;
#防止某些文件夹被直接访问
rewrite ^/(?!index\.php|robots\.txt|uploadedImages|resource|images|js|css|styles|static)(.*)$ /index.php/$1 last;
}
2.config/config.php下配置$config['index_page'] = '';
3..重启nginx
1.编辑conf/httpd.conf配置文件
#LoadModule rewrite_module modules/mod_rewrite.so 把该行前的#去掉
同时对应Directory下要配置 AllowOverride All
2.在 CI 根目录下(即在index.php,system的同级目录下)新建立一个配置文件,命名为: .htaccess 内容如下:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(application|modules|plugins|system|themes) index.php/$1 [L]
3.把system/application/config/config.php 中$config['index_page'] = "index.php";改为$config['index_page'] = "";
4.重启apache
nginx去掉index.php
1.编辑nginx.conf文件
vi /usr/local/xxxxx/nginx/conf/nginx.conf
#nginx去掉index.php
location / {
rewrite ^/$ /index.php last;
#防止某些文件夹被直接访问
rewrite ^/(?!index\.php|robots\.txt|uploadedImages|resource|images|js|css|styles|static)(.*)$ /index.php/$1 last;
}
2.config/config.php下配置$config['index_page'] = '';
3..重启nginx
相关文章推荐
- CI 框架去掉url 中index.php的方法
- 更改CI框架默认访问路径及去掉index.php
- CI框架去掉URl中的index.php部分
- 去掉 CI 框架中的 index.php
- 在nginx下去掉ci框架url中的index.php
- CI框架在 nginx 服务器上配置 rewrite 去掉 index.php 的方法:
- CI 框架怎么去掉隐藏入口文件 index.php
- phpCI框架 如何去掉默认index.php
- CI框架去掉index.php以及解决No input file specified问题
- CI框架uri去掉index.php
- CI框架在Apache服务器下去掉URL中的index.php
- php中关于ci框架修改后缀并去掉url中的index.php
- CodeIgniter学习笔记四:CI中的URL相关函数,路由,伪静态,去掉index.php
- CI框架apache和nginx环境下面统一去掉路径URL后面的index.php
- PHP CodeIgniter(CI)框架中去掉 index.php方法
- php ci 去掉index.php
- 【ci框架】单一入口文件index.php分析
- CI 框架(Apache环境)有效删除URL中的index.php 分类: CI框架 php 2014-01-20 13:17 266人阅读 评论(0) 收藏
- codeigniter的url重写问题(去掉index.php路由)