这是我的设置:
location ~ \.php$ {
include fastcgi_params;
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/html/example.com$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
}
if ($request_uri ~* "^(.*/)index\.html$") {
return 301 $1;
}
location / {
root /var/www/html/example.com;
index index.php index.html index.htm;
}
当我转到网址https://example.com/subfolder
时,浏览器会将我重定向到https://example.com/subfolder/
,如果我尝试用rewrite ^/(.*)/$ /$1 permanent;
删除尾部斜杠,则重定向太多。
是否可以删除子文件夹的斜杠?