nginx去除index.php的方法:首先打开nginx.conf配置文件;然后在虚拟主机下添加配置【if (!-e $request_filename){rewrite ^/(.*)$ /index.php/$1 last;}】即可。
配置Nginx.conf在你的虚拟主机下添加:
(推荐教程:php图文教程)
location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } }
(学习视频推荐:php视频教程)
如果你的项目入口文件在一个子目录内,则:
location /目录/ { if (!-e $request_filename){ rewrite ^/目录/(.*)$ /目录/index.php/$1 last; } }
The above is the detailed content of How to remove index.php in nginx. For more information, please follow other related articles on the PHP Chinese website!