确保您的“robots.txt”允许爬虫访问:
User-agent: *
Allow: /
此外,您可能需要向网站管理员工具提交站点地图。
听起来快照服务正确。以防万一,我发布了工作“index.php”的相关部分。静态页面位于 'static/${TOKEN}.html'
<!doctype html>
<?php
function static_url ($token) { return 'static/' . $token . '.html'; }
$escaped_fragment = $_GET['_escaped_fragment_'];
if (isset($escaped_fragment)) {
$fragment = preg_replace('/\//', '', $escaped_fragment);
$file = static_url($fragment);
if($escaped_fragment == '' || $escaped_fragment == '/'
|| (! file_exists($file))) {
$fragment = '${DEFAULT_PLACE}:${DEFAULT_STATE}'; // your default place
$file = static_url($fragment);
}
$re = '/(^<[^>]*>)|(\n|\r\n|\t|\s{2,4})*/';
$handle = fopen($file, 'r');
if ($handle != false) {
$content = preg_replace($re, '', fread($handle, filesize($file)));
fclose($handle);
}
else {
$content = 'Page not found!';
header(php_sapi_name() == 'cgi' ? 'Status: 404' : 'HTTP/1.1 404');
}
echo $content;
} else { ?>
<html> ... Your GWT host page ... </html>
<? } ?>