我有HTTP重定向到SSL //同一主機像以下:使用nginx的
server {
listen 80;
listen 443 ssl;
...
...
}
我需要做的是重定向誰訪問我的店給用戶的https:/ /。問題是我有很多的語言:
https://mydomain.com/EN /店 https://mydomain.com/FR /店 等等
我嘗試這樣做,也沒有工作(nginx: configuration file /etc/nginx/nginx.conf test failed)
:
if ($server_port = 80) {
location (en|fr)/shop {
rewrite^https://$host$request_uri permanent;
}
}
我買了你的代碼另一個錯誤:重新啓動nginx的:nginx的:EMERG]「位置」指令,在這裏不允許使用在 –
@AdamSilver:你不能有'location'的'if'塊內(見位置的文檔)。如果路徑以「(en | fr)/ shop」開頭,只需將您的重寫規則更改爲僅重寫。 –
但我會得到一個重定向循環! –