Home  >  Article  >  Backend Development  >  How to remove index.php in ci (nginx)

How to remove index.php in ci (nginx)

藏色散人
藏色散人Original
2020-08-10 09:03:563449browse

nginx下ci去掉“index.php”的方法:首先在根目录下新增“.htaccess”文件;然后修改“nginx.conf”配置文件内容为“ rewrite ^/(.*)$ /index.php/$1;”;最后保存修改即可。

How to remove index.php in ci (nginx)

推荐:《PHP视频教程

CI框架去除index.php(Nginx)

在根目录新增.htaccess文件

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

修改nginx.conf(如果有vhost.conf文件,则修改此文件)配置文件

location / {
    index  index.html index.htm index.php;
    #autoindex  on;
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php/$1;
    }
}

The above is the detailed content of How to remove index.php in ci (nginx). 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