11
私はnginx 1.0.8を使用しています.www.mysite.com/dirからすべての訪問者をgoogleの検索ページhttp://www.google.com/search?q=dirにリダイレクトしようとしています.dirは変数ですが、 "blog"(www.mysite.com/blog)ブログコンテンツ(Wordpress)をロードしたいだけです。ここでnginxは1つを除くすべてのディレクトリをリダイレクトします
は私の設定です:私はこれを行う場合
location/{
root html;
index index.html index.htm index.php;
}
location /blog {
root html;
index index.php;
try_files $uri $uri/ /blog/index.php;
}
location ~ ^/(.*)$ {
root html;
rewrite ^/(.*) http://www.google.com/search?q=$1 permanent;
}
でもwww.mysite.com/blogは、Googleの検索ページにリダイレクトされます。最後の場所を削除すると、www.mysite.com/blogがうまくいきます。
私がここで読んだこと:http://wiki.nginx.org/HttpCoreModule#locationこれは、優先順位が正規表現に最初にあり、クエリに一致する最初の正規表現が検索を停止するようです。
おかげ