Answer the question
In order to leave comments, you need to log in
How to setup try_files in nginx?
How to make in nginx so that the file domain.com/12345.html opens on request /12345 , and /12345.html , and /12345/, and /12345.html/ ? Something from this either works out, or not, but all together so that it doesn’t work out at all.
Answer the question
In order to leave comments, you need to log in
Probably something like this :)
location ~ ^/[0-9]+
{
rewrite ^/([0-9]+)[^0-9]*$ /$1.html;
}
Something like that:
location ~ ^(/\d+)(\.html)?\/?$ {
try_files $1.html =404
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question