Nginx配置PATHINFO隐藏index.php
程序员文章站
2022-06-11 14:57:40
...
Nginx配置PATHINFO隐藏index.php
Nginx配置文件里放入这段代码
Nginx配置文件里放入这段代码
server {
listen 80;
default_type text/plain;
root /var/www/html;
index index.php index.htm index.html;
#隐藏index.php
location / {
if (!-e $request_filename) {
#一级目录
# rewrite ^/(.*)$ /index.php/$1 last;
#二级目录
rewrite ^/MYAPP/(.*)$ /MYAPP/index.php/$1 last;
}
}
#pathinfo设置
location ~ \.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
AD:真正免费,域名+虚机+企业邮箱=0元
推荐阅读
-
IIS7配置环境下隐藏index.php方法介绍
-
nginx配置支持php的pathinfo模式配置方法
-
nginx中配置pathinfo模式示例
-
Nginx配置PATHINFO隐藏thinkphp index.php
-
[Linux] nginx的try_files指令实现隐藏index.php的重写
-
nginx支持codeigniter的pathinfo模式url重写配置写法示例
-
Nginx隐藏index.php和Pathinfo模式配置例子
-
在nginx中配置pathinfo模式支持thinkphp的URL重写
-
lnmp启用pathinfo并隐藏index.php,lnmppathinfo
-
Nginx配置PATHINFO隐藏index.php