Home  >  Article  >  Backend Development  >  How to hide index.php in ci

How to hide index.php in ci

coldplay.xixi
coldplay.xixiOriginal
2020-08-06 10:03:152057browse

ci隐藏index.php的方法:首先打开【rewrite_module】,并修改AllowOverride none为AllowOverride All;然后在CI的目录下面创建【.htaccess】文件并添加相关内容;最后相关内容即可。

How to hide index.php in ci

ci隐藏index.php的方法:

1.需要apache打开rewrite_module,然后修改httpd.conf的AllowOverride none为AllowOverride All(里面,不同的环境目录不同)

2.在CI的目录下面创建.htaccess文件,加入如下内容:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\\.php|images|robots\\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

3.修改config.php的内容:

$config['index_page'] = 'index.php';

替换为

$config['index_page'] = '';

相关学习推荐:php编程(视频)

The above is the detailed content of How to hide index.php in ci. For more information, please follow other related articles on the PHP Chinese website!

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