Reputation: 22171
I own an Angular app and an Apache server.
I set <meta name="fragment" content="!" />
on the <head>
part and $locationProvider.html5Mode(true);
In my .htaccess
file on the Apache server, I added this part:
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "My_Token"
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator [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|\.ttf|\.woff))(.*) http://service.prerender.io/http://example.com/$2 [P,L]
</IfModule>
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]
</IfModule>
However, when I run the following command:
curl http://example.com?_escaped_fragment_=
I don't get the prerendered file.
Sounds that Prerender's service is not triggered at all.
Did I miss some configuration?
Upvotes: 0
Views: 420
Reputation: 1604
You might be serving your index from here:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
Can you try moving the prerender config higher than that section?
Upvotes: 1