Prerender.io子页面redirect到索引

我遵循以下指南:

angular度:

$locationProvider.html5Mode(true); 

在html中,添加这个元头:

 <head> <meta name="fragment" content="!"> </head> 

configurationApache

  RewriteEngine On # If requested resource exists as a file or directory # (REQUEST_FILENAME is only relative in virtualhost context, so not usable) RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d # Go to it as is RewriteRule ^ - [L] # If non existent # If path ends with / and is not just a single /, redirect to without the trailing / RewriteCond %{REQUEST_URI} ^.*/$ RewriteCond %{REQUEST_URI} !^/$ RewriteRule ^(.*)/$ $1 [R,QSA,L] # Handle Prerender.io RequestHeader set X-Prerender-Token "YOUR_TOKEN" RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest [NC,OR] RewriteCond %{QUERY_STRING} _escaped_fragment_ # Proxy the request RewriteRule ^(.*)$ http://service.prerender.io/http://%{HTTP_HOST}$1 [P,L] # If non existent # Accept everything on index.html RewriteRule ^ /index.html 

现在我的索引网站终于被谷歌拾起。

但是,只要我试图去我的子网站它告诉我,它已被redirect到index.html

任何人都可以告诉我什么我做错了? 我已经尝试了这个星期,并没有能够拿出一个解决scheme:(

google-bot-simulator

在这里输入图像说明

您正在使用Googlebot测试您的网站,但该用户代理不在您的重写规则正在查找的可能的用户代理列表中。

 RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest [NC,OR] 

以上列出了将被代理到prerender.io的所有机器人。 更具体地说,它只列出了足以检测它们的用户代理的一部分。 如果您添加了“googlebot”,那么它也会匹配。 或者为了测试目的,可能只是“机器人”。

 RewriteCond %{HTTP_USER_AGENT} bot|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest [NC,OR] 

试一试。 此外,看看你的浏览器是否有一个“用户代理切换器”插件,让你比通过谷歌工具更快地测试。

你的htaccess看起来像什么? 我认为这将是你的子域名将显示index.html的原因:

 # If non existent # Accept everything on index.html RewriteRule ^ /index.html