In the code below, the index directive adds page1.htm
to /
requests. So I would expect an exact match for http://DOMAIN
to be matched by the 2nd location block and not the first.
index page1.htm;
location = /
{
rewrite / /page2.htm;
}
location = /page1.htm
{
rewrite /page1.htm /page3.htm;
}
But it's the first location that matches. http://DOMAIN
gives me page2.htm
and http://DOMAIN/page1.htm
gives me page3.htm.
What kind of exact match does the =
prefix enable?
I've browsed lots of docs but it's not clear to me what is happening here. If the first location is removed then http://DOMAIN
gives me page3.htm
so it seems it is using the index before attempting location matches. So in the above case, why is location = /
matching when after the index is applied the uri has become /page1.htm
?
Are the locations tested without the index applied first and then only if there is no match, are they tested again with index applied?