0
nginxウェブサーバを使用しています。 それは事前にnginxを使用してURLの一部を変更します。
https://www.example.com/#/contact-us
おかげに
https://www.example.com/abc/contact-us
からサーバーを打つ前に、私は、URLを変更したいです。単一のURIリダイレクトのために
nginxウェブサーバを使用しています。 それは事前にnginxを使用してURLの一部を変更します。
https://www.example.com/#/contact-us
おかげに
https://www.example.com/abc/contact-us
からサーバーを打つ前に、私は、URLを変更したいです。単一のURIリダイレクトのために
、exact match location
とreturn
statementは、最も効率的な場合があります
location = /abc/contact-us {
return 301 /#/contact-us;
}
rewrite
ディレクティブを使用/abc
で始まるすべてのURIをリダイレクトするには:
location ^~ /abc/ {
rewrite ^/abc(.*)$ /#$1 permanent;
}
location
ブロックは主です冗長ですが、nginx
は必要なときだけ正規表現を調べます。詳細については、this documentを参照してください。
/abc。を通過するすべてのルートでそれを行う方法? – UserV789456
回答が更新されました。 –