Javascript 如何检查prerender.io是否在我的angularjs站点上正常工作?
我遵循了本教程: 我在这里使用修改过的apacheconf(原来的不起作用,我更改了HTTP\u USER\u代理位) 现在我的.htaccess文件如下所示Javascript 如何检查prerender.io是否在我的angularjs站点上正常工作?,javascript,angularjs,.htaccess,seo,prerender,Javascript,Angularjs,.htaccess,Seo,Prerender,我遵循了本教程: 我在这里使用修改过的apacheconf(原来的不起作用,我更改了HTTP\u USER\u代理位) 现在我的.htaccess文件如下所示 # Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats # Change http://example.com (at the end of th
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "MY TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks
#RewriteRule ^api/(.*)$ http://vivule.ee/api/$1 [P,L]
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /snapshots/%1? [NC,L]
# Prerender.io stuff
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} Googlebot|bingbot|Googlebot-Mobile|Baiduspider|Yahoo|YahooSeeker|DoCoMo|Twitterbot|TweetmemeBot|Twikle|Netseer|Daumoa|SeznamBot|Ezooms|MSNBot|Exabot|MJ12bot|sogou\sspider|YandexBot|bitlybot|ia_archiver|proximic|spbot|ChangeDetection|NaverBot|MetaJobBot|magpie-crawler|Genieo\sWeb\sfilter|Qualidator.com\sBot|Woko|Vagabondo|360Spider|ExB\sLanguage\sCrawler|AddThis.com|aiHitBot|Spinn3r|BingPreview|GrapeshotCrawler|CareerBot|ZumBot|ShopWiki|bixocrawler|uMBot|sistrix|linkdexbot|AhrefsBot|archive.org_bot|SeoCheckBot|TurnitinBot|VoilaBot|SearchmetricsBot|Butterfly|Yahoo!|Plukkie|yacybot|trendictionbot|UASlinkChecker|Blekkobot|Wotbox|YioopBot|meanpathbot|TinEye|LuminateBot|FyberSpider|Infohelfer|linkdex.com|Curious\sGeorge|Fetch-Guess|ichiro|MojeekBot|SBSearch|WebThumbnail|socialbm_bot|SemrushBot|Vedma|alexa\ssite\saudit|SEOkicks-Robot|Browsershots|BLEXBot|woriobot|AMZNKAssocBot|Speedy|oBot|HostTracker|OpenWebSpider|WBSearchBot|FacebookExternalHit [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://vivule.ee/$2 [P,L]
</IfModule>
</IfModule>
#如果要缓存URL和查看爬网统计信息,请将_标记更改为prerender标记并取消对该行的注释
#改变http://example.com (在上一条规则的末尾)添加到您的网站url
RequestHeader设置X-Prerender-Token“我的Token”
重新启动发动机
选项+FollowSymLinks
#重写规则^api/(*)$http://vivule.ee/api/$1[P,L]
#不要重写文件或目录
RewriteCond%{REQUEST_FILENAME}-f[或]
RewriteCond%{REQUEST_FILENAME}-d
重写规则^-[L]
#将所有其他内容重写为index.html,以允许html5状态链接
重写规则^index.html[L]
重写cond%{REQUEST_URI}^/$
RewriteCond%{QUERY_STRING}^_转义_片段_=/?(.*)$
是否重写规则^(.*)$/snapshots/%1?[北卡罗来纳州,L]
#Prerender.io文件
RewriteCond%{HTTP_USER_AGENT} 谷歌(Google)谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌(谷歌)谷歌谷歌谷歌谷歌(雅虎)雅虎(雅虎)搜索者,雅虎(雅虎)雅虎(雅虎)雅虎)Ya胡寻求寻求者,Do抄抄录录录波(Do卡门门方)Twitter(Twitter)Twitter,Twitter(Twitter)T波(Twitter)Twitter)TT波(Twitter)TTT波(Twitter)谷歌谷歌谷歌(Twitter)Twitter)T波(Twitter)Twitter)TTTTT波波(Twitter)Twitter)TTTwe波波(Twitter)Tweweet波波(Twitter)谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌(T波(Twitter)T波(T波(Twitter)Twitter)谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌Genieo\sWeb\sfilter | Qualidator.com\sBot | Woko | Vagabondo | 360Spider | ExB\sLanguage\sCrawler | AddThis.com | aiHitBot | Spinn3r | BingPreview | GrapeshotCrawler | CareerBot | ZumBot | ShopWiki | bixocrawler | uMBot | sistrix | linkdexbot AhrefsBot | archive.org | bot SeoCheckBot|(12)北京奥运会(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,日,雅基机器人(12)日,路径机器人(12)日,路径机器人(12)日,路径机器人(12)日,路波机器人)日,日,日,路波机器人(12)日,日,日,月,日,日,日,日,日,日,日,日波机器人(12月机器人,日,日,日,日,日,日,日,日,日,日,日,日,日,日,日,日,日波波机器人,日,日,日,日,日,日,BLEXBot | woriobot | AMZNKAssocBot | Speedy | oBot | HostTracker | OpenWebSpider | WBSearchBot | FacebookExternalHit[NC,或]
重写cond%{QUERY\u STRING}\u转义\u片段_
#如果是HTML请求,则仅代理预呈现请求
(10.js 124?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????|\.mov\.psd\.ai\.xls\.mp4\.m4a\.swf\.dat\.dmg\.iso\.flv\.m4v\.torrent))(.*http://service.prerender.io/http://vivule.ee/$2[P,L]
但若我像推荐的那个样使用逃逸片段进行测试,似乎什么也并没有发生。你可以检查自己:或者
如果我尝试facebook的共享功能,它仍然会得到html,而html不会被angular脚本修改。(尝试此工具:获取最新数据,但无效)
有没有办法测试预渲染是否正常工作?好的,我修复了它,似乎我所要做的就是将“RewriteRule^index.html[L]”移到.htaccess文件的末尾。htaccess文件是从上到下读取的,我猜它以前从未进入预渲染部分 下面是有效的.htaccess代码: #如果要缓存URL和查看爬网统计信息,请将_标记更改为prerender标记并取消对该行的注释 #更改(在上一个重写规则的末尾)到您的网站url
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "MY SECRET TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks
#RewriteRule ^api/(.*)$ http://vivule.ee/api/$1 [P,L]
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /snapshots/%1? [NC,L]
# Prerender.io stuff
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} Googlebot|bingbot|Googlebot-Mobile|Baiduspider|Yahoo|YahooSeeker|DoCoMo|Twitterbot|TweetmemeBot|Twikle|Netseer|Daumoa|SeznamBot|Ezooms|MSNBot|Exabot|MJ12bot|sogou\sspider|YandexBot|bitlybot|ia_archiver|proximic|spbot|ChangeDetection|NaverBot|MetaJobBot|magpie-crawler|Genieo\sWeb\sfilter|Qualidator.com\sBot|Woko|Vagabondo|360Spider|ExB\sLanguage\sCrawler|AddThis.com|aiHitBot|Spinn3r|BingPreview|GrapeshotCrawler|CareerBot|ZumBot|ShopWiki|bixocrawler|uMBot|sistrix|linkdexbot|AhrefsBot|archive.org_bot|SeoCheckBot|TurnitinBot|VoilaBot|SearchmetricsBot|Butterfly|Yahoo!|Plukkie|yacybot|trendictionbot|UASlinkChecker|Blekkobot|Wotbox|YioopBot|meanpathbot|TinEye|LuminateBot|FyberSpider|Infohelfer|linkdex.com|Curious\sGeorge|Fetch-Guess|ichiro|MojeekBot|SBSearch|WebThumbnail|socialbm_bot|SemrushBot|Vedma|alexa\ssite\saudit|SEOkicks-Robot|Browsershots|BLEXBot|woriobot|AMZNKAssocBot|Speedy|oBot|HostTracker|OpenWebSpider|WBSearchBot|FacebookExternalHit [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://vivule.ee/$2 [P,L]
</IfModule>
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]
</IfModule>
RequestHeader设置X-Prerender-Token“我的秘密令牌”
重新启动发动机
选项+FollowSymLinks
#重写规则^api/(*)$http://vivule.ee/api/$1[P,L]
#不要重写文件或目录
RewriteCond%{REQUEST_FILENAME}-f[或]
RewriteCond%{REQUEST_FILENAME}-d
重写规则^-[L]
重写cond%{REQUEST_URI}^/$
RewriteCond%{QUERY_STRING}^_转义_片段_=/?(.*)$
是否重写规则^(.*)$/snapshots/%1?[北卡罗来纳州,L]
#Prerender.io文件
RewriteCond%{HTTP_USER_AGENT} 谷歌(Google)谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌(谷歌)谷歌谷歌谷歌谷歌(雅虎)雅虎(雅虎)搜索者,雅虎(雅虎)雅虎(雅虎)雅虎)Ya胡寻求寻求者,Do抄抄录录录波(Do卡门门方)Twitter(Twitter)Twitter,Twitter(Twitter)T波(Twitter)Twitter)TT波(Twitter)TTT波(Twitter)谷歌谷歌谷歌(Twitter)Twitter)T波(Twitter)Twitter)TTTTT波波(Twitter)Twitter)TTTwe波波(Twitter)Tweweet波波(Twitter)谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌(T波(Twitter)T波(T波(Twitter)Twitter)谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌谷歌Genieo\sWeb\sfilter | Qualidator.com\sBot | Woko | Vagabondo | 360Spider | ExB\sLanguage\sCrawler | AddThis.com | aiHitBot | Spinn3r | BingPreview | GrapeshotCrawler | CareerBot | ZumBot | ShopWiki | bixocrawler | uMBot | sistrix | linkdexbot AhrefsBot | archive.org | bot SeoCheckBot|(12)北京奥运会(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,雅基机器人(12)日,日,雅基机器人(12)日,路径机器人(12)日,路径机器人(12)日,路径机器人(12)日,路波机器人)日,日,日,路波机器人(12)日,日,日,月,日,日,日,日,日,日,日,日波机器人(12月机器人,日,日,日,日,日,日,日,日,日,日,日,日,日,日,日,日,日波波机器人,日,日,日,日,日,日,BLEXBot | woriobot | AMZNKAssocBot | Speedy | oBot | HostTracker | OpenWebSpider | WBSearchBot | FacebookExternalHit[NC,或]
重写cond%{QUERY\u STRING}\u转义\u片段_
#如果是HTML请求,则仅代理预呈现请求
(10.js 124?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????|\.mov\.psd\.ai\.xls\.mp4\.m4a\.swf\.dat\.dmg\.iso\.flv\.m4v\.torrent))(.*http://service.prerender.io/http://vivule.ee/$2[P,L]
#将所有其他内容重写为index.html,以允许html5状态链接
重写规则^index.html[L]
能否检查是否启用了mod_rewrite.c和mod_proxy_http.c?此外,您应该删除您的Prerender.io令牌,并通过我们的UI生成一个新令牌,这样就没有人可以使用您的令牌来缓存您帐户下的页面。@Prerender.io谢谢您的建议,一些好的adm