博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CI路径中如何去掉index.php
阅读量:6863 次
发布时间:2019-06-26

本文共 1003 字,大约阅读时间需要 3 分钟。

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

转载于:https://www.cnblogs.com/antik/p/3990677.html

你可能感兴趣的文章
LeetCode 26 号问题 删除数组中的重复项
查看>>
让控件如此丝滑Scroller和VelocityTracker的API讲解与实战——Android高级UI
查看>>
Html 5.2 的简单介绍及新增元素 <dialog></dialog>
查看>>
ES6的几个实用技巧,你了解吗?
查看>>
看BAT技术面试官如何挑选Java程序员
查看>>
AI强势来袭,锁上手机就真的安全了吗?
查看>>
Spring 中的 context
查看>>
重构代码(应如写诗)
查看>>
Vue混入mixins
查看>>
前阿里 P9 级员工称离婚是模拟测试,已回滚复婚!
查看>>
衡阳a货翡翠,南平a货翡翠
查看>>
大姨太入场,EtcGame全线升级为Coingame,开启ETH投注倒计时……
查看>>
阿里云HBase推出全新X-Pack服务 定义HBase云服务新标准
查看>>
通过Auto Layout深入了解SizeClasses的好处和使用
查看>>
Spring scope解惑
查看>>
BCH与BCE共享比特币之名
查看>>
js脚本 处理js注入
查看>>
A potentially dangerous Request.Form value was detected from the client
查看>>
测试过程之过分关注功能性测试
查看>>
SQL Server -- LIKE模糊查询
查看>>