...
...
Andrei Demian @ Software Engineer OPSWAT. TimJS - 2015
<meta name="fragment" content="!">
http://www.example.com/user/1
http://www.example.com/user/1?_escaped_fragment_=
http://www.example.com/#!/user/1
http://www.example.com/?_escaped_fragment_=/user/1
RewriteCond %{HTTP_USER_AGENT} (Google|Facebot|Googlebot|bingbot) [NC] RewriteCond %{QUERY_STRING} _escaped_fragment_ RewriteRule ^ http://prerender.local/http://yourdomain.com/%{REQUEST_URI} [P,L]
// Page is ready
window.prerenderReady = true;
// Replace #! in shared URLs
www.mydomain/#!/stats => www.mydomain.com/sharer/stats
// hashbang urls in angular
$location.hasPrefix = '!';
// Detect crawlers and redirect them to the prerender server
RewriteCond %{HTTP_USER_AGENT} (Google|Facebot|Googlebot|bingbot) [NC]
RewriteRule ^sharer/(.*) /?_escaped_fragment_=/$1 [P,L]
// Detect humans and redirect them to #!
RewriteCond %{HTTP_USER_AGENT} ! (Google|Facebot|Googlebot|bingbot) [NC]
RewriteRule ^sharer/(.*) /#!/$1 [NE,L,R=301]