我想要输入的是test.com/path,然后将其转到anothersite.com,但是将其转到differentsite.com。我相信我的格式正确,但似乎完全跳过了位置块。
server {
listen 80;
listen [::]:80;
server_name test.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
listen [::]:443;
server_name test.com;
location /path {
return 301 https://anothersite.com;
}
return 301 https://differentsite.com;
}
答案 0 :(得分:1)
事实证明,服务器块不应具有return语句。每个路径应该有两个带有返回语句的位置块
[{"additionalLocaleInfos": [], "approved": false, "approvedBy": null, "approvedOn": null, "catalogId": 4, "code": "611",
"createdOn": "2018-03-24 09:39", "customsCode": null, "deletedOn": null, "id": 1, "invariantName": "Leisure Ali Baba Trousers", "isPermanent": false, "locale": null, "madeIn": null,
"manufacturer": {"createdOn": "2018-02-23 18:20", "deletedOn": null, "id": 1, "invariantName": "Unknown", "updatedOn": "2018-02-23 18:20"},
"onNoStockShowComingSoon": false, "season": "", "updatedOn": "2018-03-24 09:39",
"variants": [{"assets": [{"fileName": "mu/2016/05/16/leisure-ali-baba-trousers-32956-0.jpg", "id": 1,
"mediaType": {"baseFilePath": "Catalog", "id": 7, "name": "Product Main Image"}, "sortOrder": 0}]} ]}]