Remove index.php from ci framework
ci框架去掉index.php的方法:首先打开apache的配置文件;然后将相关“.htaccess”的该行信息改为“AllowOverride All”;接着在CI的根目录下建立“.htaccess”;最后修改CI中配置文件即可。
本文操作环境:Windows7系统、CodeIgniter3.0、Dell G3电脑。
CI框架去除index.php
打开apache的配置文件,conf/httpd.conf :
LoadModule rewrite_module modules/mod_rewrite.so
把该行前的#去掉。
搜索 AllowOverride None(配置文件中有多处),看注释信息,将相关.htaccess的该行信息改为:
AllowOverride All
在CI的根目录下,即在index.php,system的同级目录下,建立.htaccess,直接建立该文件名的不会成功,可以先建立记事本文件,另存为该名的文件即可。内容如下(CI手册上也有介绍):
RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L]
如果不在根目录下:
RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /目录/index.php/$1 [L]
将CI中配置文件(application/config/config.php)中
$config['index_page'] = "index.php";
改成:
$config['index_page'] = "";
重启apache,完成。
推荐:《PHP视频教程》
The above is the detailed content of Remove index.php from ci framework. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
