2014-04-24 46 views
0

我有阿賈克斯的網站,它的靜態版本的文件夾:的谷歌博特NGINX配置文件 - 重寫

/_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

試着看error.log –

+0

添加的錯誤日誌 – WaNgeL

回答

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; 
    } 
}