0
我想爲我的一個NGINX配置使用更輕的代碼。我只需要在以下四行中寫出以下四行(如果可能!):如何在nginx中對不同的重寫規則進行分組?
location /en/contact {
rewrite ^/.* https://$server_name/contact permanent;
}
location /en/quality {
rewrite ^/.* https://$server_name/quality permanent;
location /de/contact {
rewrite ^/.* https://$server_name/contact permanent;
}
location /de/quality {
rewrite ^/.* https://$server_name/quality permanent;
}
謝謝!
「輕」是什麼意思?前綴位置(您現在擁有)可能是最有效的。您可以使用一個效率較低的正則表達式 - 但也更少打字。 –
我的目標是有最小的打字。我怎麼能在這種情況下使用正則表達式?我在這方面很新穎......效率是一個重點......我想比較兩個版本。 – Savi