Home  >  Article  >  Backend Development  >  CI framework remove indexphp excel index index finger z index

CI framework remove indexphp excel index index finger z index

WBOY
WBOYOriginal
2016-07-29 08:51:151117browse

转自:http://zhidao.baidu.com/link?url=VmpVphh36EFXQGr65dit9hvMOLh_kHA333fcEQK_VQIByvxrXM0WeeWslLfSV-8OEnpcbt31YOSGfgqtXHVCwcZIVUKBYfAdb_JgnDMSkdu

正文:

<span>apache环境下:
通过 .htaccess 文件来设置一些简单的规则删除它。下面是一个例子,使用“negative”方法将非指定内容进行重定向:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

如果你的项目不在根目录请把上面这一句改为:RewriteRule ^(.*)$ index.php/$1 [L]
在上面的例子中,可以实现任何非 index.php、images 和 robots.txt 的 HTTP 请求都被指向 index.php。

Nginx环境下:
修改nginx配置文件,在SERVER段中添加如下代码:
location /{
   if (-f $request_filename) {
       expires max;
       break;
   }
   if (!-e $request_filename) {
       rewrite ^/(.*)$ /index.php/$1 last;
   }
}</span>

以上就介绍了CI框架去除indexphp,包括了index方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn