How to remove index.php in ci (nginx)

藏色散人
Release: 2023-03-04 07:16:01
Original
3380 people have browsed it

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>
Copy after login

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

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

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!

Related labels:
ci
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!