我想從這些工作規則移動Nginx的重寫一些匹配規則不工作
location = /contact {
rewrite ^(.*)$ /index.php?v=contact last; break;
}
location = /terms {
rewrite ^(.*)$ /index.php?v=terms last; break;
}
location = /faq {
rewrite ^(.*)$ /index.php?v=faq last; break;
}
location = /twitter {
rewrite ^(.*)$ /index.php?v2=twitter last; break;
}
location = /facebook {
rewrite ^(.*)$ /index.php?v2=facebook last; break;
}
location = /login {
rewrite ^(.*)$ /index.php?v2=login last; break;
}
location = /privacy {
rewrite ^(.*)$ /index.php?v=privacy last; break;
}
到這樣的事情
location/{
try_files $uri $uri/ =404;
rewrite ^/(contact|privacy|terms|faq)$ /index.php?v=$1 last;
rewrite ^/(twitter|facebook|login)$ /index.php?v2=$1 last; break;
}
但問題是,「聯繫人」,「術語','隱私','推特','臉譜'頁面正常工作,但'隱私'和'登錄'頁面扔404錯誤。
有涉及「登錄」和「隱私」
建議打開調試日誌,找出跟蹤這兩個404網址。 – TroyCheng
@TroyCheng'open()「/ usr/share/nginx/www/privacy」失敗(2:沒有這樣的文件或目錄)'所以這根本就不是重寫 – user1612250
我的意思是打開調試選項時,可以跟蹤重寫過程在error_log中,因此您可以知道它是如何重寫以及哪裏出錯的。 – TroyCheng