How to hide index.php in nginx

王林
Release: 2020-08-01 15:44:29
Original
6075 people have browsed it

nginx隐藏index.php的方法:直接在vhosts.conf配置文件中添加代码“if ( !-e $request_filename) {rewrite ^/(.*)$ /index.php/$1 last;break;}”即可。

How to hide index.php in nginx

首先打开项目配置文件vhosts.conf;

(推荐教程:nginx使用教程

然后在配置文件中添加如下代码即可。

if ( !-e $request_filename) {
	rewrite ^/(.*)$ /index.php/$1 last;
	break;
}
Copy after login

具体配置如图:

How to hide index.php in nginx

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

Related labels:
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