【发布时间】:2013-07-01 11:38:24
【问题描述】:
我有一个非常繁重的 Javascript 应用程序,我希望将其编入索引。我的网站上有一个快照目录,可以提供给 Google 机器人。这些在mysite.com/snapshots/ 下。
我正在使用以下重写规则将快照提供给 Google 机器人:
location / {
if ($args ~ "_escaped_fragment_=") {
rewrite ^/(.*)$ /snapshots/$1.html break;
}
}
这适用于我的所有快照,除了主页。问题是,主页被保存为mysite.com/snapshots/index.html。当 Google bot 请求 mysite.com/?_escaped_fragment_= 时,nginx 尝试为 /snapshots/.html 提供服务,显然是请求 404。
当请求文档根目录时,我需要调整重写规则以提供 index.html。
干杯!
【问题讨论】: