我需要从URL进行永久重定向:
https://SiteName.com/shop/forklift-tires/XXX/
to
https://SiteName.com/shop/tires/forklift-tires/XXX/
Run Code Online (Sandbox Code Playgroud)
要么
https://SiteName.com/shop/forklift-tires/YYY/
to
https://SiteName.com/shop/tires/forklift-tires/YYY/
Run Code Online (Sandbox Code Playgroud)
我该如何使用下面的结构呢?
location *something* {
return 301 *something*;
}
Run Code Online (Sandbox Code Playgroud)
从文章“陷阱和常见错误”中我了解到,最好使用return而不是rewrite。