我对友善网址有疑问。以下脚本可以正常运行,但目前不像
/index.php
有用
/index
有用
/index/
不起作用(我希望它可以与/index
打开同一页面)
如何解决这个问题?
location / {
autoindex on;
root /var/www/plasti;
index index.php index.html index.htm;
if ($request_uri ~ ^/(.*)\.php$) { return 302 /$1; }
try_files $uri $uri/ $uri.html $uri.php?$args;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
#fastcgi_connect_timeout 300s;
fastcgi_read_timeout 120s;
#fastcgi_send_timeout 300s;
}