【问题标题】:nginx x rewrite pattern 404 error (help)nginx x 重写模式 404 错误(帮助)
【发布时间】:2014-07-22 11:12:42
【问题描述】:

我有一个问题,下面是服务器块。除最后一个位置块外,所有重写都运行良好。访问链接时。它给出了 404 错误。似乎找不到解决办法。

server
{
    listen     80;
    server_name   fontistic.com;
    location / {
        root   /var/www/fontistic.com/;
        index  index.html index.htm index.php;
    }
    location ~ \.html$ {
        rewrite ^/(.*).html /$1.php last;
    }
    location /top_rated {
        rewrite ^/top_rated/(.*)/$ /top_fonts.php?page=$1;
        rewrite ^(.*)$ /top_fonts.php;
    }
    location /fonts {
        rewrite ^/fonts/(.*)/(.*)$ /font_details.php?f=$1;
    }
}

访问的链接是http://fontistic.com/fonts/1416/berthside.html

【问题讨论】:

    标签: php nginx url-rewriting


    【解决方案1】:

    网址http://fontistic.com/fonts/1416/berthside.htmllocation ~ \.html$ 捕获。
    试试http://fontistic.com/fonts/1416/berthside.htm,你会得到正确的页面。

    查看question 了解 nginx 位置优先级。

    【讨论】:

      猜你喜欢
      • 2017-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      • 2011-04-16
      相关资源
      最近更新 更多