我在文件夹中有ajax网站及其静态版本:
/_escaped_fragment_/
我的配置,不起作用:
# nginx configuration
location / {
if ($query_string ~ "^_escaped_fragment_=$"){
rewrite ^(.*)$ /_escaped_fragment_$1/index.html? break;
}
if ($query_string ~ "^_escaped_fragment_=(.*)$"){
rewrite ^(.*)$ /_escaped_fragment_$1/%1/index.html? break;
}
}
谷歌机器人请求:
"GET /?_escaped_fragment_=/page/nerjav HTTP/1.1" 404 232 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
我只需要转:
/#!/page/nerjav -> /_escaped_fragment_/page/nerjav/index.html
错误日志:
2014/04/24 16:43:14 [error] 6087#0: *1 rewrite or internal redirection cycle while processing "/_escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment_//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html", client: 66.249.66.194, server: m-chel.ru, request: "GET /?_escaped_fragment_=/page/nerjav HTTP/1.1", host: "site.com"
2014/04/24 16:43:56 [error] 6087#0: *2 rewrite or internal redirection cycle while processing "/_escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment__escaped_fragment_//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html//page/nerjav/index.html", client: 109.191.139.106, server: m-chel.ru, request: "GET /?_escaped_fragment_=/page/nerjav HTTP/1.1", host: "site.com"
答案 0 :(得分:1)
我不确定你的事情是如何运作的,但看起来你错过了=
。
# nginx configuration
location / {
if ($query_string ~ "^_escaped_fragment_=$"){
rewrite ^(.*)$ /_escaped_fragment_=$1/index.html? break;
}
if ($query_string ~ "^_escaped_fragment_=(.*)$"){
rewrite ^(.*)$ /_escaped_fragment_=$1/%1/index.html? break;
}
}