Încerc să redirecționez adresele URL cu Ninx, dar mă străduiesc să o fac corect:
example.com/{dynamic1}/foo/bar/{dynamic2}
la example.com/{dynamic1}/bar/{dynamic2}
practic, încerc să elimin /foo/
porțiune din url.
am incercat urmatoarele:
locație ~* ^/(.*)/foo/bar/(.*)$ {
returnează 302 ^/$1/bar/$2?$args;
}
Si deasemenea:
locație ~ ^/([^/]*)/foo/bar/(.*)$ {
returnează 302 ^/$1/bar/$2?$args;
}
dar asta aruncă eroarea 414 Solicitare-URI prea mare
iar URL-ul ajunge să fie (scurtat pentru claritate):
dynamic1/cams/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E /dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/ dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1 /bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/ bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar /%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/ %5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/ dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1/bar/%5E/dynamic1 /bar/%5E/dynamic1/bar/ %5E/dynamic1/bar/%5E/dynamic1/bar/dynamic2?
ce fac greșit?
Rețineți că, odată ce înțeleg bine, voi înlocui 302 cu 301.