Prerender.io для сервера Apache Angularjs
Я пытался заставить http://prerender.io/ работать на моем сайте. Я почти уверен, что правильно следовал их инструкциям, но когда я запускаю сайт с помощью симулятора Googlebot, он показывает, что он неправильно читает сайт.
Я следовал инструкциям здесь: https://prerender.io/getting-started Мой сайт называется www.justbuythisgame.com
У меня есть это в моем.htaccess:
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "MyTokenIsCorrectAswell"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
# Only proxy the request to Prerender if it's a request for HTML
RewriteRule ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent))(.*) http://service.prerender.io/http://justbuythisgame.com/$2 [P,L]
</IfModule>
</IfModule>
Я также добавил это в свой заголовок, даже если это не повлияет на то, как Google сканирует index.html.
<meta name="fragment" content="!">
Это то, что показывает мне, когда я сканирую сайт, где вы можете видеть, что он не получает никакого HTML
HTTP/1.1 200 OK
Date: Tue, 22 Apr 2014 09:49:43 GMT
Server: Apache
Last-Modified: Tue, 22 Apr 2014 09:37:23 GMT
Accept-Ranges: bytes
Cache-Control: max-age=0
Expires: Tue, 22 Apr 2014 09:49:43 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
X-UA-Compatible: IE=edge
Content-Length: 1983
Keep-Alive: timeout=3, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="title" content="Just Buy This Game" />
<meta name="description" content="JustBuyThisGame is a website that collect data about the most played games, from different websites. We use this data to create a simple list where you easily can see which trending game is the most popular and best rated. If you buy any of the games we suggest, you won't regret it!">
<meta name="robots" content="index,follow" />
<meta name="language" content="en" />
<meta name="viewport" content="width=device-width">
<meta name="fragment" content="!">
<base href="/">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/select2/select2.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css({.tmp,app}) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<script src='https://cdn.firebase.com/v0/firebase.js'></script>
<!-- endbuild -->
</head>
<body ng-app="justbuythisgame" ng-cloak>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div ng-include src="'views/layout/header.html'"></div>
<div ng-view></div>
<div ng-include src="'views/layout/footer.html'"></div>
<!-- Add your site or application content here -->
<!--[if lt IE 9]>
<script src="bower_components/es5-shim/es5-shim.js"></script>
<script src="bower_components/json3/lib/json3.min.js"></script>
<![endif]-->
<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/select2/select2.js"></script>
<script src="bower_components/angular-ui-select2/src/select2.js"></script>
<!-- endbower -->
<!-- endbuild -->
<script src="bower_components/foundation/js/vendor/jquery.js"></script>
<script src="bower_components/foundation/js/foundation/foundation.js"></script>
<script src="bower_components/foundation/js/foundation/foundation.reveal.js"></script>
<script src="bower_components/foundation/js/foundation/foundation.topbar.js"></script>
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<!-- endbuild -->
<script src="scripts/app.js"></script>
<script src="scripts/filters.js"></script>
<!--<script src="scripts/controllers/main.js"></script>-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.4/angular-resource.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.4/angular-route.min.js"></script>
<script src="https://cdn.firebase.com/v0/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/0.5.0/angularfire.min.js"></script>
</body>
</html>