这两个 url 为什么一个正常一个 404 呢?

2019-11-11 22:10:35 +08:00
 ysoserious

nginx 配置如下

location / {
	try_files $uri $uri/ =404;
}

location ~ \.php$ {
	fastcgi_split_path_info ^(.+?\.php)(/.*)$;
	include fastcgi_params;

	fastcgi_param PATH_INFO       $fastcgi_path_info;
	fastcgi_index index.php;
	fastcgi_param  REDIRECT_STATUS    200;
	fastcgi_param  SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
	fastcgi_param  DOCUMENT_ROOT /var/www/html;
	fastcgi_pass php:9000;
}

nginx 日志

"GET /index.php/PHP%0Ais_the_shittiest_lang.php HTTP/1.1" 200
"GET /index.php/PHP%0ASOSAT HTTP/1.1" 404
1496 次点击
所在节点    问与答
2 条回复
PHPer233
2019-11-11 22:18:31 +08:00
第一个 url 匹配了*.php 规则,第二个 url 没匹配上*.php 规则,所以是 404。
ysoserious
2019-11-11 22:38:18 +08:00
@PHPer233 #1 忘了 $, 感谢提醒

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/618606

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX