例如:符合 /abc/mm/ 的網址轉址到 /cde/ 底下
location = /abc/mm {
return 301 /cde/;
}
location = /abc/mm/ {
return 301 /cde/;
}
(註:/abc/mm/ 最後面的斜線有沒有加,在 IE 似乎效果不太一樣?)
參考:
In Nginx, how can I rewrite all http requests to https while maintaining sub-domain?
Nginx redirect one path to another
How to redirect a url in NGINX
using trailing slashes in nginx configuration
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
沒有留言:
張貼留言