Nginx重写不适用于典型扩展

时间:2019-09-09 15:50:11

标签: nginx mod-rewrite url-rewriting nginx-location

我有一个像这样的nginx重写位置conf

location /playernew {
    error_log /home/heyka/rewrite-error.log debug;
    if ($request_filename ~ /playernew/([A-Za-z0-9_-]+)/(.+)){
      rewrite /playernew/([A-Za-z0-9_-]+)/(.+) /playernew/$2 break;
    }

例如网址.com/playernew/wydra/assets/css/style.csss有效。注意扩展名为.csss

在日志中,我有:

2019/09/09 17:35:41 [notice] 28519#0: *103 "/playernew/([A-Za-z0-9_-]+)/(.+)" matches "/home/website/www/playernew/wydra/assets/css/style.csss", client: ip, server: nocache.website.com, request: "GET /playernew/wydra/assets/css/style.csss HTTP/1.1", host: "nocache.website.com"
2019/09/09 17:35:41 [notice] 28519#0: *103 "/playernew/([A-Za-z0-9_-]+)/(.+)" matches "/playernew/wydra/assets/css/style.csss", client: ip, server: nocache.website.com, request: "GET /playernew/wydra/assets/css/style.csss HTTP/1.1", host: "nocache.website.com"
2019/09/09 17:35:41 [notice] 28519#0: *103 rewritten data: "/playernew/assets/css/style.csss", args: "", client: ip, server: nocache.website.com, request: "GET /playernew/wydra/assets/css/style.csss HTTP/1.1", host: "nocache.website.com"
2019/09/09 17:35:41 [error] 28519#0: *103 open() "/home/website/www/playernew/assets/css/style.csss" failed (2: No such file or directory), client: ip, server: nocache.website.com, request: "GET /playernew/wydra/assets/css/style.csss HTTP/1.1", host: "nocache.website.com"

但是...

当我按下.com/playernew/wydra/assets/css/style.css时。注意.css ...不能正常工作。日志中没有任何内容。没有。像rewrite命令一样不存在。

即使使用类似...的配置

location /playernew {
    error_log /home/arek/rewrite-error.log debug;
    rewrite style.css / break;

一样:/

为什么?发生了什么事?

为什么.csss有效,而.css无效。与其他常规扩展名相同。

再次->点击/playernew/wydra/setup/index.phpp会生成日志并重写作品。

但是按下/playernew/wydra/setup/index.php ...没有日志+无效。

对我来说,任何典型的扩展名都有问题

0 个答案:

没有答案