服务器使用一键lnmp安装的,开启了pathinfo模式后发现使用header跳转时index会被过滤。
使用的是TP系统,U方法与header location之后会出现这种情况,
如`http://xx.com/index.php/a/b` 会变成`http://xx.com/.php/a/b`,而地址栏输入没有问题
贴上配置文件
1、站点conf
```
server
{
listen 80;
#listen [::]:80;
server_name xx.com ;
index index.html index.htm index.php default.html default.htm default.php;
root /data;
include none.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
#include enable-php.conf;
include enable-php-pathinfo.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log xx.com.log;
}
```
2、enable-php-pathinfo.conf
```
location ~ [^/]\.php(/|$)
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
```
3、fastcig.conf
```
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
##4、pathinfo.conf
##```
index index.html index.htm index.php default.html default.htm default.php;
你把前面的index去掉