0

I have a problem, the following is the server block. all rewrites work well except for the last location block. when the link is accessed. it gives a 404 error. cant seem to find a solution.

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;
    }
}

the link being accessed is http://fontistic.com/fonts/1416/berthside.html

1 Answers1

0

Url http://fontistic.com/fonts/1416/berthside.html was captured by location ~ \.html$.
Try http://fontistic.com/fonts/1416/berthside.htm, you will get the right page.

See this question for nginx location priority.

Community
  • 1
  • 1
xiaochen
  • 1,283
  • 2
  • 13
  • 30