我是新手Linux用户,我正在努力确保我的角度/引导应用程序的SEO排名。我曾尝试在我共享的GoDaddy服务器上的几个文件夹中的.htaccess文件中应用prerender.io中间件,但无济于事。我已经联系了该产品的所有者Todd,但他无法提供可行的解决方案。他似乎有点不知所措。
我错过了什么? .htaccess应该放在哪里?这是我想要预呈现的site。
我的.htaccess文件位于public_html之前的文件夹中:
更新(最新完成.htaccess)
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
</IfModule>
<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
RewriteCond %{SERVER_PORT} 80
# 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
<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))(index.html.var)(.*) http://service.prerender.io/http://writers-tryst.ron-tornambe.com/$3 [P,L] </IfModule>
</IfModule>
修改
我按如下方式修改了导航栏列表:
<ul class="nav navbar-nav">
<li class="active"><a id="homepage" href="?_escaped_fragment_=/"><i class="glyphicon glyphicon-home"></i> Home</a></li>
<li><a href="?_escaped_fragment_=/writers/" class="glyphicon glyphicon-book"> Writers</a></li>
角度&#34;当&#34;看起来像这样:
wtApp.config(function ($routeProvider) {
$routeProvider
// route for the home page
.when('/', {
templateUrl: 'pages/home.html',
controller: 'mainController'
})
// route for the writers page
.when('/writers', {
templateUrl: 'pages/writers.html',
controller: 'writersController'
})
网址如下所示:
http://writers-tryst-test.ron-tornambe.com/?_escaped_fragment_=/writers#/
不显示作者页面。它仍然在主页上。
我不知道为什么要添加#。如果我删除它,它就会被重新插入。
我会继续调整它 - 我知道我很接近。
答案 0 :(得分:1)
您希望重新生成Prerender.io令牌,因为您在配置中将其暴露在那里。其他人可以使用您的令牌,并为您提供大额账单。转到我们网站的“帐户”部分,您将看到在那里重新生成令牌的选项。
此外,即使您在该正则表达式中有3个捕获组,您仍然有2美元。第三个捕获组是您要发送给我们服务的。
您是否尝试过我上次发送给您的配置?
# 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 "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
<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))(index.html.var)(.*) http://service.prerender.io/http:/%{HTTP_HOST}/$3 [P,L] </IfModule>
</IfModule>
如果有效,请告诉我。很乐意提供帮助!