我在同一主机上有 http:// 和 https://,如下所示:
server {
listen 80;
listen 443 ssl;
...
...
}
我需要做的是将访问我的商店的用户重定向到https://
。问题在于我有很多语言:
https://example.com/en/shop
https://example.com/fr/shop
- 等等...
我尝试过这个方法,但它没有起作用(nginx:配置文件/etc/nginx/nginx.conf测试失败)
:
if ($server_port = 80) {
location (en|fr)/shop {
rewrite ^ https://$host$request_uri permanent;
}
}